-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added info about LicenseManager.ReleaseLicense() (#189)
* added info about LicenseManager.ReleaseLicense() * fixed links * Update apiconcepts/releasenotes/overview.md Review suggestion. Co-authored-by: catalina-adam <[email protected]> * Update apiconcepts/releasenotes/overview.md Review suggestion. Co-authored-by: catalina-adam <[email protected]> * Update apiconcepts/projectautomation/overview.md Suggestion from review. Co-authored-by: catalina-adam <[email protected]> * Update apiconcepts/releasenotes/tradosstudio2022sr2.md Suggestion from review. Co-authored-by: catalina-adam <[email protected]> * Update apiconcepts/releasenotes/tradosstudio2022sr2.md Suggestion from review. Co-authored-by: catalina-adam <[email protected]> * Update apiconcepts/releasenotes/tradosstudio2022sr2.md Suggestion from review. Co-authored-by: catalina-adam <[email protected]> * Update apiconcepts/projectautomation/overview.md Suggestion from review. Co-authored-by: catalina-adam <[email protected]> * Update apiconcepts/projectautomation/overview.md Suggestion from review. Co-authored-by: catalina-adam <[email protected]> * Update apiconcepts/projectautomation/overview.md Suggestion from review. Co-authored-by: catalina-adam <[email protected]> --------- Co-authored-by: catalina-adam <[email protected]>
- Loading branch information
1 parent
88d2e75
commit d07f81c
Showing
9 changed files
with
128 additions
and
87 deletions.
There are no files selected for viewing
114 changes: 57 additions & 57 deletions
114
Plugins/TradosStudioDocsPlugin/TradosStudioDocsPlugin/VariableInlineRule.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,57 @@ | ||
using Microsoft.DocAsCode.MarkdownLite; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace TradosStudioDocsPlugin | ||
{ | ||
public class VariableInlineRule : IMarkdownRule | ||
{ | ||
public string Name => "VariableToken"; | ||
|
||
// define my regex to match | ||
// private static readonly Regex _envVarRegex = new Regex(@"^\<Var:(\w+?)\>", RegexOptions.IgnoreCase); | ||
|
||
public IMarkdownToken TryMatch(IMarkdownParser parser, IMarkdownParsingContext context) | ||
{ | ||
var _envVarRegex = new Regex(@"^\<Var:(\w+?)\>", RegexOptions.IgnoreCase); | ||
var match = _envVarRegex.Match(context.CurrentMarkdown); | ||
if (match.Length == 0) | ||
{ | ||
return null; | ||
} | ||
|
||
var envVar = match.Groups[1].Value; | ||
string text = GetValueForVariable(envVar); | ||
if (text == null) | ||
{ | ||
return null; | ||
} | ||
|
||
// 'eat' the characters of the current markdown token so they anr | ||
var sourceInfo = context.Consume(match.Length); | ||
return new MarkdownTextToken(this, parser.Context, text, sourceInfo); | ||
} | ||
|
||
private static string GetValueForVariable(string envVar) | ||
{ | ||
|
||
var replacementValues = new Dictionary<string, string> | ||
{ | ||
{ "ProductName", "Trados Studio" }, | ||
{ "ProductNameWithEdition", "Trados Studio 2021" }, | ||
{ "ProductVersion", "Studio16" }, | ||
{ "VersionNumber", "16" }, | ||
{ "VisualStudioEdition", "Microsoft Visual Studio 2019" }, | ||
{ "PluginPackedPath", "%AppData%\\SDL\\SDL Trados Studio\\16\\Plugins\\Packages\\" }, | ||
{ "PluginUnpackedPath", "%AppData%\\SDL\\SDL Trados Studio\\16\\Plugins\\Unpacked\\" }, | ||
{ "InstallationFolder", "C:\\Program Files\\SDL\\SDL Trados Studio\\Studio16" }, | ||
{ "AppSigningEmail", "[email protected]" } | ||
}; | ||
|
||
return Environment.GetEnvironmentVariable(envVar) ?? | ||
(replacementValues.ContainsKey(envVar) ? replacementValues[envVar] : null); | ||
|
||
} | ||
} | ||
} | ||
using Microsoft.DocAsCode.MarkdownLite; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace TradosStudioDocsPlugin | ||
{ | ||
public class VariableInlineRule : IMarkdownRule | ||
{ | ||
public string Name => "VariableToken"; | ||
|
||
// define my regex to match | ||
// private static readonly Regex _envVarRegex = new Regex(@"^\<Var:(\w+?)\>", RegexOptions.IgnoreCase); | ||
|
||
public IMarkdownToken TryMatch(IMarkdownParser parser, IMarkdownParsingContext context) | ||
{ | ||
var _envVarRegex = new Regex(@"^\<Var:(\w+?)\>", RegexOptions.IgnoreCase); | ||
var match = _envVarRegex.Match(context.CurrentMarkdown); | ||
if (match.Length == 0) | ||
{ | ||
return null; | ||
} | ||
|
||
var envVar = match.Groups[1].Value; | ||
string text = GetValueForVariable(envVar); | ||
if (text == null) | ||
{ | ||
return null; | ||
} | ||
|
||
// 'eat' the characters of the current markdown token so they anr | ||
var sourceInfo = context.Consume(match.Length); | ||
return new MarkdownTextToken(this, parser.Context, text, sourceInfo); | ||
} | ||
|
||
private static string GetValueForVariable(string envVar) | ||
{ | ||
|
||
var replacementValues = new Dictionary<string, string> | ||
{ | ||
{ "ProductName", "Trados Studio" }, | ||
{ "ProductNameWithEdition", "Trados Studio 2022" }, | ||
{ "ProductVersion", "Studio17" }, | ||
{ "VersionNumber", "17" }, | ||
{ "VisualStudioEdition", "Microsoft Visual Studio 2022" }, | ||
{ "PluginPackedPath", "%AppData%\\SDL\\SDL Trados Studio\\17\\Plugins\\Packages\\" }, | ||
{ "PluginUnpackedPath", "%AppData%\\SDL\\SDL Trados Studio\\17\\Plugins\\Unpacked\\" }, | ||
{ "InstallationFolder", "C:\\Program Files\\SDL\\SDL Trados Studio\\Studio17" }, | ||
{ "AppSigningEmail", "[email protected]" } | ||
}; | ||
|
||
return Environment.GetEnvironmentVariable(envVar) ?? | ||
(replacementValues.ContainsKey(envVar) ? replacementValues[envVar] : null); | ||
|
||
} | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,36 @@ | ||
Introduction | ||
===== | ||
This documentation provides practical examples of how to use the Project Automation API, which allows programmatic access to the project automation functionality of <Var:ProductName>. Apart from various code snippets that demonstrate common use cases you will also find a fully-documented command-line sample application that showcases how to automate project creation and batch task functionality. | ||
|
||
What you can do with this SDK | ||
---- | ||
The Project Automation API is concerned with the automation of common project management tasks such as file analysis, pre-translation, generation of finalized target documents, etc. Based on this API you could potentially build fully-fledged, customized workflow systems. Below you find examples of applications for the API: | ||
|
||
* Developing a Command-line application that traverses a folder / sub-folder structure to analyze or pre-translate the translatable documents contained therein. | ||
* Develop an application that creates custom analysis reports for importing into an accounting system. | ||
* Develop an application for fully automating the project creation process, e.g. create multiple projects according to a template with one mouse-click. | ||
* Schedule automated project package creation and assigning manual tasks to a number of users. The application can then upload the packages to an FTP server or forward them via e-mail. | ||
* An application that is timed to automatically loop through a folder into which translators/editors have delivered their return packages. The application then imports the return packages, thereby updating the corresponding projects, generates an updated project statistics report, which is then forwarded to the responsible project manager. | ||
* An application that loops through a number of translated bilingual (SDLXliff) documents and that batch-updates the corresponding master translation memories on a regular basis. | ||
* An application for testing whether a set of native documents can be converted to a translatable (SDLXliff) format prior to creating a project. The application loops through a folder structure, identifies any translatable documents and converts them SDLXliff. Upon failure, a report is generated that states the file and (if applicable) the reason why the conversion failed (e.g. a Microsoft Word document has the track changes functionality switched on) | ||
* An application that loops through multiple projects and generates the finalized target files, which are then automatically forwarded to the end customer via e-mail or uploaded to an FTP share. In case of any failure to generate the target documents, an automated mail can be send to the project manager. | ||
|
||
> [!NOTE] | ||
> | ||
> Note that the Project Automation API might sometimes have to be used in conjunction with the Translation Memory API to cover specific use-cases, e.g. when certain information such as the number of translation units, the TM languages, etc. needs to be read from a TM. This SDK contains an example of how to retrieve the languages of a specified TM using the Translation Memory API and then create a project based on the TM language direction. | ||
Introduction | ||
===== | ||
This documentation provides practical examples of how to use the Project Automation API, which allows programmatic access to the project automation functionality of <Var:ProductName>. Apart from various code snippets that demonstrate common use cases, you will also find a fully-documented command-line sample application that showcases how to automate project creation and batch task functionality. | ||
|
||
|
||
What you can do with this SDK | ||
---- | ||
The Project Automation API is concerned with the automation of common project management tasks such as file analysis, pre-translation, generation of finalized target documents, etc. Based on this API you could potentially build fully-fledged, customized workflow systems. Below you can find examples of applications for the API: | ||
|
||
|
||
* Developing a Command-line application that traverses a folder / sub-folder structure to analyze or pre-translate the translatable documents contained therein. | ||
* Develop an application that creates custom analysis reports for importing into an accounting system. | ||
* Develop an application for fully automating the project creation process, e.g. create multiple projects according to a template with one mouse-click. | ||
* Schedule automated project package creation and assigning manual tasks to a number of users. The application can then upload the packages to an FTP server or forward them via e-mail. | ||
* An application that is timed to automatically loop through a folder into which translators/editors have delivered their return packages. The application then imports the return packages, thereby updating the corresponding projects, generates an updated project statistics report, which is then forwarded to the responsible project manager. | ||
* An application that loops through a number of translated bilingual (SDLXliff) documents and that batch-updates the corresponding master translation memories on a regular basis. | ||
* An application for testing whether a set of native documents can be converted to a translatable (SDLXliff) format prior to creating a project. The application loops through a folder structure, identifies any translatable documents and converts them SDLXliff. Upon failure, a report is generated that states the file and (if applicable) the reason why the conversion failed (e.g. a Microsoft Word document has the track changes functionality switched on) | ||
* An application that loops through multiple projects and generates the finalized target files, which are then automatically forwarded to the end customer via e-mail or uploaded to an FTP share. In case of any failure to generate the target documents, an automated mail can be send to the project manager. | ||
|
||
> [!NOTE] | ||
> | ||
> In specific use-cases, you may need to use the Project Automation API in conjunction with the Translation Memory API. For instance, when extracting information like the number of translation units and the languages supported by the translation memory. | ||
You can find a practical example of how to use the Translation Memory API to retrieve such details and then create a project based on the TM language direction. | ||
|
||
> [!IMPORTANT] | ||
> | ||
> If you are building a standalone application that consumes Project Automation APIs that require a license, you must call `LicenseManager.ReleaseLicense()` before the application exits. | ||
> | ||
>Otherwise, a license will be blocked on the user's machine for additional time after the application is closed. The duration of this extension varies depending on the license type: | ||
> * When using a network license, the license will be blocked for an additional 5 minutes. | ||
> * When using a subscription license, the license will be blocked for an additional 30 minutes. | ||
> * When using a standalone local license (license key) this limitation does not apply. | ||
> | ||
> The `LicenseManager` class is located in the assembly Sdl.TranslationStudioAutomation.Licensing. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Release Notes for <Var:ProductNameWithEdition> SR2 | ||
=================== | ||
|
||
# Added API licensing support for subscriptions | ||
When creating standalone apps, you can now use Project automation API calls that need a license even if <Var:ProductName> is licensed through a subscription. This expands the list of supported scenarios where <Var:ProductName> is licensed through a perpetual license, or through a network server license. | ||
|
||
> [!NOTE] | ||
> | ||
> Starting with <Var:ProductNameWithEdition> SR2, when developing a standalone application using Project Automation APIs that require a license, make sure to call `LicenseManager.ReleaseLicense()` before the application exits. See [Project Automation Overview](../projectautomation/overview.md) for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters