Skip to content

Commit

Permalink
Added info about LicenseManager.ReleaseLicense() (#189)
Browse files Browse the repository at this point in the history
* 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
ropop-rws and catalina-adam authored Oct 17, 2023
1 parent 88d2e75 commit d07f81c
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 87 deletions.
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 modified TradosStudioTemplate/Plugins/TradosStudioDocsPlugin.dll
Binary file not shown.
Binary file modified TradosStudioTemplate/Plugins/TradosStudioDocsPlugin.pdb
Binary file not shown.
56 changes: 36 additions & 20 deletions apiconcepts/projectautomation/overview.md
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.
6 changes: 5 additions & 1 deletion apiconcepts/releasenotes/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ A list of API changes released together with the RTM version of <Var:ProductName

[API Changes for <Var:ProductNameWithEdition> SR1](tradosstudio2022sr1.md)

A list of API changes released together with the SR1 version of <Var:ProductNameWithEdition>
A list of API changes released together with the SR1 version of <Var:ProductNameWithEdition>.

[API Changes for <Var:ProductNameWithEdition> SR2](tradosstudio2022sr2.md)

A list of API changes released together with the SR2 version of <Var:ProductNameWithEdition>.

9 changes: 9 additions & 0 deletions apiconcepts/releasenotes/tradosstudio2022sr2.md
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.
4 changes: 3 additions & 1 deletion apiconcepts/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -846,4 +846,6 @@
- name: Release Notes for Trados Studio 2022
href: releasenotes/tradosstudio2022.md
- name: Release Notes for Trados Studio 2022 SR1
href: releasenotes/tradosstudio2022sr1.md
href: releasenotes/tradosstudio2022sr1.md
- name: Release Notes for Trados Studio 2022 SR2
href: releasenotes/tradosstudio2022sr2.md
4 changes: 2 additions & 2 deletions articles/gettingstarted/community_plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Intro

This repository contains around 80 plugins developed for <Var:ProductName>. Most of the plugins were developed by RWS, but you might also find a few of them which were initially developed by someone else. For all these plugins we now have full source code ownership according to our [License agreement](https://github.com/RWS/Sdl-Community/blob/master/License.md). You can find the complete list of plugins [here](#list-of-plugins).
This repository contains around 80 plugins developed for <Var:ProductName>. Most of the plugins were developed by RWS, but you might also find a few of them which were initially developed by someone else. For all these plugins we now have full source code ownership according to our [License agreement](https://github.com/RWS/Sdl-Community/blob/master/LICENSE). You can find the complete list of plugins [here](#list-of-plugins).

We encourage everyone who is interested to contribute, either by fixing some issues, implementing new features or improving the documentation. To contribute, clone this repository, make the changes and send us a [pull request](https://www.codenewbie.org/blogs/how-to-make-a-pull-request) with your changes.

Expand All @@ -14,7 +14,7 @@ If you have any questions, don’t hesitate to ask on the [RWS Language Develope

Once you have [set up your development machine](setting_up_a_developer_machine.md), follow the steps below:

- Clone this repository (more details [here](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)). In order to clone the repository using Source Tree, from menu select “Clone/New”. In source path paste this path: https://github.com/sdl/Sdl-Community.git. In destination path, select a path where you want to store the repository on your drive:
- Clone this repository (more details [here](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository)). In order to clone the repository using Source Tree, from menu select “Clone/New”. In source path paste this path: https://github.com/RWS/Sdl-Community.git. In destination path, select a path where you want to store the repository on your drive:

- After the repository was cloned, navigate to the repository path you’ve specified when cloning the repository. Each plugin has a dedicated folder. All you need to do is to find the plugin you’re looking for, enter the folder and open the solution file using Microsoft Visual Studio.

Expand Down
22 changes: 16 additions & 6 deletions articles/gettingstarted/plugin_use_cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,68 @@

## Create new <Var:ProductName> features

### [MSWord Grammar Checker](https://appstore.sdl.com/language/app/msword-grammar-checker/392/)
### [MSWord Grammar Checker](https://appstore.rws.com/Plugin/84)

<img style="display:block; " src="images/MSWordGrammarChecker.png" />

This app adds grammar checking capability to SDL Trados Studio by integrating the grammar checking feature of MS Word into the editor view.

### [Glossary Plugin](https://appstore.sdl.com/language/app/glossary-plugin/365/)
### [Glossary Plugin](https://appstore.rws.com/Plugin/166)

<img style="display:block; " src="images/Glossaryplugin.png" />

As an extra feature in the ribbon, this plug-in allows users to add terminology to projects in <Var:ProductName> with just a few clicks.

### [Jobs](https://appstore.sdl.com/language/app/jobs/463/)
### [Jobs](https://appstore.rws.com/Plugin/32)

<img style="display:block; " src="images/Jobs.png" />

The Jobs plug-in adds a new view where users can find ProZ.com translation job posts online within Studio easily and quickly using search filters.

## Access external resources

<!-- TODO: Enable this content when it is added on AppStore
### [EU DocFinder]()
<img style="display:block; " src="images/eudocfinder.jpg" />
The EU created DocFinder, allowing users to highlight text within the editor and search a document repository to find matches for this text.
-->

### [Web Lookup!](https://appstore.sdl.com/language/app/web-lookup/455/)
### [Web Lookup!](https://appstore.rws.com/Plugin/4)

<img style="display:block; " src="images/weblookup.png" />
This app allows users to highlight a word or phrase to perform a web search on directly within <Var:ProductName>'s translation editor environment.

<!-- TODO: Enable this content when it is added on AppStore
### [EU Cross-lingual concordance]()
<img style="display:block; " src="images/eucrosslingual.jpg" />
Developed by the EU, their cross-lingual concordance search allows users to leverage work from other neighbouring languages to get the context of how a particular word/phrase is used
-->

## Integrate with apps and products

### [Post-Edit Compare](https://appstore.sdl.com/language/app/post-edit-compare/610/)
### [Post-Edit Compare](https://appstore.rws.com/Plugin/15)

<img style="display:block; " src="images/PostEditCompare.jpg" />

Creating a brand new view in <Var:ProductName>, the Post-Edit Compare app provides a full analysis of Post-Editing work in an extensive report format.

<!-- TODO: Enable this content when it is added on AppStore
### [Content Connector]()
<img style="display:block; " src="images/contentconnector.jpg" />
Content connector allows you to create projects instantly by dropping files into a set location - a great example of a project automation app.
-->

<!-- TODO: Enable this content when it is added on AppStore
### [Tilde Terminology](https://appstore.sdl.com/language/app/tilde-terminology-plugin/511/)
<img style="display:block; " src="images/TildeTerminology.png" />
Built for Tilde users, it automatically analyses a source segment within <Var:ProductName>, identifies term candidates within it and looks up for translations on the fly.
Built for Tilde users, it automatically analyses a source segment within <Var:ProductName>, identifies term candidates within it and looks up for translations on the fly.
-->

0 comments on commit d07f81c

Please sign in to comment.