The Trados PowerShell Toolkit allows scripting the Project Automation API that is available with Trados Studio Professional. A Professional license for Trados Studio is required to use the API via this toolkit.
- Modules:
GetGuids
,PackageHelper
,ProjectHelper
,ProjectServerHelper
,ProvidersHelper
,TMHelper
,TMServerHelper
,ToolkitInitializer
,UserManagerHelper
- Scripts:
FileBasedProject_Roundtrip.ps1
,ServerBasedProject_Roundtrip.ps1
,UserManager_Roundtrip.ps1
,TMServer_Roundtrip.ps1
- Samples: Demonstration files for
FileBasedProject_Roundtrip.ps1
For setup, configuration, and usage details, refer to the subsequent sections.
Expand
Ensure the following requirements are met before using this toolkit:
- Trados Studio License
- A Trados Studio license is mandatory for the operation of this toolkit.
- PowerShell Version
- Ensure that PowerShell 5 (x86) is installed and configured on your system. PowerShell 5.1 is included by default in Windows 10 (version 1607 and later) and Windows 11. For other versions of Windows, you may need to manually install or upgrade to PowerShell 5.0 or 5.1. Follow these steps if you are unsure Check installed version of Powershell
- Installation
- Follow the instructions in the Installation section to properly set up the toolkit on your system.
- Script Configuration
- Properly configure the script according to the provided guidelines to ensure smooth functionality. Detailed instructions can be found in the Configuring the scripts section.
- (Optional) GroupShare Server
- If you wish to use the GroupShare extension, ensure you have access to an existing GroupShare server. The toolkit can interact with GroupShare to enhance project management and translation processes.
- Download the Files:
- Ensure you have downloaded all necessary files for the toolkit, including the sample roundtrip scripts and PowerShell modules. These files are available at the official releases page. Be sure to download the latest release to ensure you have the most up-to-date version of the toolkit.
- After downloading, you may need to unblock the zip file. For instructions on how to unblock files, see Ensuring File Permissions for Toolkit File.
- Create Required Folders:
- First, create the following folders if they do not already exist:
C:\users\{your_user_name}\Documents\WindowsPowerShell
C:\users\{your_user_name}\Documents\WindowsPowerShell\Modules
- First, create the following folders if they do not already exist:
- Copy Sample Roundtrip Scripts
- Copy the sample roundtrip scripts into the
WindowsPowerShell
folder:FileBasedProject_Roundtrip.ps1
ServerBasedProject_Roundtrip.ps1
TMServer_Roundtrip.ps1
UserManager_Roundtrip.ps1
- Ensure these files are placed directly in the
C:\Users\{your_user_name}\Documents\WindowsPowerShell
directory.
- Copy the sample roundtrip scripts into the
- Copy PowerShell Modules:
- Next, copy the PowerShell modules into the
modules
folder:....\WindowsPowerShell\Modules\GetGuids
....\WindowsPowerShell\Modules\PackageHelper
....\WindowsPowerShell\Modules\ProjectHelper
....\WindowsPowerShell\Modules\ProjectServerHelper
....\WindowsPowerShell\Modules\ProvidersHelper
....\WindowsPowerShell\Modules\TMHelper
....\WindowsPowerShell\Modules\TMServerHelper
....\WindowsPowerShell\Modules\ToolkitInitializer
....\WindowsPowerShell\Modules\UserManagerHelper
- Ensure each module folder contains its respective
.psd1
and.psm1
files.
- Next, copy the PowerShell modules into the
- Verify File Locations
- Confirm that the files are located in the correct directories:
- Scripts should be in
C:\Users\{your_user_name}\Documents\WindowsPowerShell
- Modules should be in
C:\Users\{your_user_name}\Documents\WindowsPowerShell\Modules
with appropriate subfolders for each module.
- Scripts should be in
- Confirm that the files are located in the correct directories:
Following these steps will ensure that the PowerShell toolkit is set up correctly and ready for use.
The ToolkitInitializer
module includes the Import-ToolkitModules
function, which is responsible for importing the toolkit, ensuring that all necessary dependencies are included, and resolving any dependency conflicts.
The Import-ToolkitModules
function takes two parameters:
StudioVersion
: Specifies the version of Trados Studio to be used, such as Studio 2022 or Studio 2024.VaultName
: Represents the name of the secure vault where credentials for translation providers (e.g., Amazon, Google) are stored. These credentials are used during project creation when the project includes such providers.- If
VaultName
is provided, the toolkit will check if theMicrosoft.PowerShell.SecretManagement
andMicrosoft.PowerShell.SecretStore
modules are installed. If these modules are not already present, the toolkit will install them automatically, as they are required for secure credential storage.
- If
-
Setting the Trados Studio Version and/or Vault Name
- Configuring the toolkit with specific values for
StudioVersion
andVaultName
allows you to call Import-ToolkitModules without needing to specify these arguments every time. Set these variables directly in the ToolkitInitializer.psm1 file located at:....\WindowsPowerShell\Modules\ToolkitInitializer\ToolkitInitializer.psm1
- Note: The
VaultName
parameter is optional and only necessary if you plan to use translation providers (e.g., Amazon, Google). If you don’t intend to use providers, you can omit this parameter. - This configuration simplifies the toolkit initialization process by letting you call the function parameterless.
- Example Configuration
After setting these variables, you can simply call:
[String] $StudioVersion = "Studio18" # Replace "Studio18" with the correct Trados Studio version [String] $vaultName = "MySecureVault" # Replace "MySecureVault" with your vault name for credential storage
without needing to specify the parameters each time.Import-ToolkitModules
- Configuring the toolkit with specific values for
-
Dynamic Version and Vault Assignment
- For dynamic assignment, users can specify the StudioVersion and VaultName parameters directly when calling Import-ToolkitModules. This method is useful if you prefer to set these values at runtime instead of configuring them in advance.
- Example Command:
Import-ToolkitModules -StudioVersion "Studio18" -VaultName "MySecureVault"
- Here, replace
"Studio18"
with the Trados Studio version you are using and"MySecureVault"
with the name of your vault if you are using translation providers.
- Example Command:
- For dynamic assignment, users can specify the StudioVersion and VaultName parameters directly when calling Import-ToolkitModules. This method is useful if you prefer to set these values at runtime instead of configuring them in advance.
For details on locating the correct Trados Studio version, refer to the Finding the Studio Version section.
This section assumes that you are providing the VaultName
with the intent to include translation providers at project creation.
As the project creation process in the Project Automation API requires that the translation provider credentials be available during project creation, this toolkit provides a module called ProvidersHelper
. The ProvidersHelper
module is responsible for storing credentials for these translation providers (Amazon, Google, DeepL). This module allows you to create, update, read, and delete these translation provider credentials from the secure credential store.
- Why Secure Credential Storage is Important
- It is essential to store the credentials of translation providers securely to ensure the protection of sensitive information, such as API keys and access tokens. By using the
VaultName
, the toolkit securely manages these credentials during project creation and throughout the workflow.
- It is essential to store the credentials of translation providers securely to ensure the protection of sensitive information, such as API keys and access tokens. By using the
- Setting Up the Credential Store
- When the VaultName is provided, the toolkit automatically checks if the
Microsoft.PowerShell.SecretManagement
andMicrosoft.PowerShell.SecretStore
modules are installed. If these modules are not found, they will be installed as part of the configuration process, enabling secure storage for the provider credentials. - Example: Initializing Credential Storage with a Vault Name
- If you intend to use translation providers, initialize the credential storage by specifying a
VaultName
:ReplaceImport-ToolkitModules -StudioVersion "Studio18" -VaultName "MySecureVault"
"Studio18"
with the version of Trados Studio you are using (e.g.,"Studio2024"
) and"MySecureVault"
with the name of your chosen vault for secure credential storage.
- When the VaultName is provided, the toolkit automatically checks if the
- Adding Translation Provider Credentials
-
Once your vault is initialized, you can add credentials for your translation providers using the
ProvidersHelper
module. The module provides theSet-MTCredential
,Get-MTCredential
, andRemove-MTCredential
cmdlets to manage translation provider credentials. -
When using the
Set-MTCredential
cmdlet to add credentials, you will be prompted to securely input the required secrets for each provider. -
Example: Adding Credentials for Amazon Translate
Set-MTCredential -Type "Amazon"
After running this command, you will be prompted to enter the necessary API key or other required credentials for Amazon Translate. The credentials will be securely stored in your vault.
-
Example: Adding Credentials for Google
Set-MTCredential -Type "Google"
You will be prompted to provide the API key or credentials for Google Cloud Translate. Once entered, the credentials will be securely stored in your vault.
-
- Managing Credentials
- The
ProvidersHelper
module offers the following cmdlets to manage the stored credentials:Get-MTCredential
: Retrieve stored credentials for a specific provider.Set-MTCredential
: Add or update credentials for a translation provider.Remove-MTCredential
: Delete credentials for a specific provider.- Example: Retrieving Stored Credentials for DeepL
Get-MTCredential -Type "DeepL"
- Example: Deleting Stored Credentials for Amazon
Remove-MTCredential -Type "Amazon"
- The
- Using Translation Providers During Project Creation
- With the translation providers configured and credentials securely stored, the toolkit will automatically search for these credentials when a new project is created. During the project creation process, the toolkit will retrieve the appropriate credentials from the secure vault and associate them with the project. This ensures that translation providers (such as Amazon, Google, or DeepL) are seamlessly integrated into the project without requiring manual intervention.
- Supported Translation Providers
- The following translation providers are currently supported:
- Amazon
- DeepL
- Microsoft
- Language Weaver
- The following translation providers are currently supported:
Important Note: The Language Cloud Translation Engine will also be available once Trados Studio 2024 CU2 is released. Stay tuned for updates on its availability.
To properly run the various roundtrip scripts, you must configure the parameters specific to each script. Here’s how to set up each type:
- Set Studio Version:
- Configure the
$StudioVersion
parameter to match the version of Trados Studio you are using. - Example:
$StudioVersion = "Studio18"
- Configure the
- Set Project Source Files:
- Configure the
$ProjectSourceFiles
parameter to point to the location of theSample
folder. - Example:
$ProjectSourceFiles = "C:\Path\To\Samples"
- Configure the
2. Server-Based Roundtrips (ServerBasedProject_Roundtrip.ps1
, TMServerHelper_Roundtrip.ps1
, UserManager_Roundtrip.ps1
, UserManager_Roundtrip.ps1
)
(Optional: Only if you are using GroupShare server functionalities).
These configurations apply to all the server-based roundtrip scripts listed above.
- Set Studio Version:
- Configure the
$StudioVersion
parameter similarly as for the file-based roundtrip. - Example:
$StudioVersion = "Studio18"
- Configure the
- Set GroupShare Server Details:
- Server URL:
- Configure the
$ServerUrl
parameter with the URL of your GroupShare server. - Example:
$ServerUrl = "http://your-group-share-server-url"
- Configure the
- Authentication:
- Set the
$UserName
and$Password
parameters with your GroupShare credentials. - Example:
$UserName = "your-username"
$Password = "your-password"
- Set the
- Server URL:
This section assumes that all the Roundtrip files have been configured as described in the Roundtrips configuration section. Follow the steps below to run the scripts for file-based and server-based operations:
- Open PowerShell as an Administrator:
- Right-click on the PowerShell icon and select "Run as Administrator."
- Set the Execution Policy (If Needed):
- If you have not unblocked the files as described in the Ensuring File Permissions for Toolkit Files section, you might need to allow script execution by setting the execution policy. To do this, execute:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
- This command allows PowerShell script execution without requiring local Windows admin privileges and needs to be executed once per machine and per user profile.
- Note: If you have already unblocked all the files (see Ensuring File Permissions for Toolkit Files), you may not need to set the execution policy. Unblocking the files can sometimes resolve script execution issues without changing the execution policy.
- If you have not unblocked the files as described in the Ensuring File Permissions for Toolkit Files section, you might need to allow script execution by setting the execution policy. To do this, execute:
- Change to the Directory Where Your Script Is Located:
- Navigate to the directory containing your script:
- cd C:\users{your_user_name}\Documents\WindowsPowerShell
- Navigate to the directory containing your script:
- Run the File-Based Roundtrip Script:
- To execute the
FileBasedProject_Roundtrip.ps1
script, type.\FileBasedProject_Roundtrip.ps1
- This script creates and processes file-based translation memories, projects, and packages.
- To execute the
- Optional: Run the Server-Based Project Roundtrip Script (If Using GroupShare Server):
- If you are using GroupShare functionalities, execute the
ServerBasedProject_Roundtrip.ps1
script after the file-based roundtrip script.
- If you are using GroupShare functionalities, execute the
- Optional: Run the TM Server Roundtrip Script (If Using GroupShare Server):
- To execute the
TMServer_Roundtrip.ps1
script, type.\TMServer_Roundtrip.ps1
- To execute the
- Optional: Run the User Manager Roundtrip Script (If Using GroupShare Server):
- To execute the
UserManager_Roundtrip.ps1
script, type.\UserManager_Roundtrip.ps1
- To execute the
Here’s an example of a complete session to run the file-based roundtrip script:
# Open PowerShell as Administrator and set the execution policy if needed
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
# Navigate to the directory containing the script
cd C:\users\{your_user_name}\Documents\WindowsPowerShell
# Run the File-Based Roundtrip Script
.\FileBasedProject_Roundtrip.ps1
To determine your Trados Studio version, follow these steps:
- Navigate to Installation Directory:
- Check one of the following directories on your system to locate Trados Studio:
C:\Program Files (x86)\Trados\Trados Studio
C:\Program Files\Trados\Trados Studio
(ifProgram Files (x86)
does not exist)
- Check one of the following directories on your system to locate Trados Studio:
- Identify the Version Folder:
In the directory you find, the folder name typically corresponds to the version of Trados Studio installed. For example:
- Studio 2022 will be in a folder named
Studio17
- Studio 2024 will be in a folder named
Studio18
- Studio 2022 will be in a folder named
By identifying the folder name, you can determine the version of Trados Studio you are using.
To utilize the Trados Studio Toolkit functions, follow these steps:
To begin using the toolkit functions, you must first import the ToolkitInitializer module into your PowerShell session. This step assumes you have correctly placed the module in the designated WindowsPowerShell
directory.
- Command:
Import-Module -Name ToolkitInitializer
Note: If you receive an error indicating that the module cannot be found, ensure that the module directory is included in your PowerShell module path. You might need to update the $env:PSModulePath
environment variable.
- Module Not Found Error: Verify that the module is in the correct directory and that the path is included in the
$env:PSModulePath
environment variable. You can view the current paths with:$env:PSModulePath
- If needed, add the module directory to the path:
$env:PSModulePath += ";C:\Users\{YourUserName}\Documents\WindowsPowerShell\Modules"
- Replace
{YourUserName}
with your actual Windows username.
- If needed, add the module directory to the path:
- Example for User-Specific Directory:
$env:PSModulePath += ";C:\Users\JohnDoe\Documents\WindowsPowerShell\Modules"
- Permanently Permanently Add the Path to
$env:PSModulePath
: If you wish to add the path permanently so that it remains available across sessions and reboots, follow these steps:- Open PowerShell as Administrator
- Add the Directory to the Environment Variable:
$modulePath = "C:\Users\{Your_username}\Documents\WindowsPowerShell\Modules" [System.Environment]::SetEnvironmentVariable("PSModulePath", "$env:PSModulePath;$modulePath", [System.EnvironmentVariableTarget]::User)
- Replace
Your_username
with the actual username - To confirm the path has been added permanently:
$env:PSModulePath
- Import the Toolkit Module by Specifying Its Path: If you prefer or need to import the module by specifying its path directly, you can do so using the following command:
Import-Module "C:\Users\{YourUserName}\Documents\WindowsPowerShell\Modules\ToolkitInitializer"
- Replace
{YourUserName}
with your actual Windows username.
- Replace
Once the ToolkitInitializer
module is imported, you need to call the Import-ToolkitModules
method. This step may require parameters depending on your configuration.
- Command:
Import-ToolkitModules
- Optional Parameters: If you need to specify parameters based on your configuration, include them as required:
Import-ToolkitModules -StudioVersion "Studio18"
After importing the module and calling the Import-ToolkitModules
method, all the functions from the Trados Studio Toolkit will be available for use in your PowerShell session.
Here’s a complete example of how to import the module and call the toolkit functions:
# Import the ToolkitInitializer module
Import-Module -Name ToolkitInitializer
# Import toolkit modules (if parameters are needed, adjust accordingly)
Import-ToolkitModules
Function Name | Definition | Module |
---|---|---|
Import-ToolkitModules | Imports all modules from the toolkit. | ToolkitInitializer |
Remove-ToolkitModules | Removes all the loaded modules. | ToolkitInitializer |
Get-Guids | Gets the file ids of the given project files returning a collection of Guids | GetGuids |
Import-Package | Imports a return package into the provided file based project | PackageHelper |
Export-Package | Creates a package from the provided file based project | PackageHelper |
New-Project | Creates a new file based project. | ProjectHelper |
Remove-Project | Removes a file based project. | ProjectHelper |
Get-Project | Opens a file based project returning FileBasedProject object. | ProjectHelper |
Get-AnalyzeStatistics | Gets the given file based project's statistics. | ProjectHelper |
Get-TaskFileInfoFiles | Gets the task files of the given target language from an existing file based project. | ProjectHelper |
Get-ProjectServer | Creates an instance of the CredentialStore class with server connection details. | ProjectServerHelper |
Show-ServerbasedProjects | Retrieves all projects information from the specified organization and optionally the projects info within the suborganizations. | ProjectServerHelper |
Get-ServerbasedProject | Downloads and copies a server-based project including the source and target language files to a specified local folder. | ProjectServerHelper |
Set-CheckOutFiles | Performs checkout for the provided projects. | ProjectServerHelper |
Set-CheckOutFiles | Performs checkout for the provided projects. | ProjectServerHelper |
Publish-Project | Publishes an existing project to the GroupShare server. | ProjectServerHelper |
UnPublish-Project | Removes the specified project from the GroupShare server. | ProjectServerHelper |
Get-MTCredential | Retrieves stored credentials for a specific translation provider. | ProvidersHelper |
Remove-MTCredential | Deletes stored credentials for a specific translation provider. | ProvidersHelper |
Set-MTCredential | Adds or updates credentials for a specific translation provider. | ProvidersHelper |
New-FileBasedTM | Creates a new file based TM. | TMHelper |
Open-FileBasedTM | Opens an existing file based TM. | TMHelper |
Get-TargetTMLanguage | Gets the target language of a TM. | TMHelper |
Get-Language | Gets a language as a Trados Language. | TMHelper |
Get-Languages | Gets a list of languages as Trados Languages | TMHelper |
Get-UserManager | Connects to the User Management Server and retrieves the UserManagerClient object. | UserManagerHelper |
Get-AllUsers | Retrieves a list of all users from the User Management Server. | UserManagerHelper |
Get-User | Retrieves detailed information about a specific user by username. | UserManagerHelper |
New-User | Creates a new user in the User Management Server. | UserManagerHelper |
Remove-User | Removes a specified user from the User Management Server. | UserManagerHelper |
Get-AllOrganizations | Retrieves all existing organizations from the User Management Server. | UserManagerHelper |
Get-Organization | Retrieves detailed information about a specific organization by its path. | UserManagerHelper |
Get-TMServer | Establishes a connection to a Translation Memory (TM) Server using the specified server address, username, and password, returning a TranslationProviderServer object. | TMServerHelper |
Get-DbServers | Retrieves a list of all database servers associated with a given TM Server, returning these database servers as a collection of DatabaseServer objects. | TMServerHelper |
Get-Containers | Retrieves a list of all containers associated with the specified TM Server, returning them as a collection of containers. | TMServerHelper |
Get-ServerbasedTMs | Queries a TM Server for ServerBased Translation Memories (TMs), with optional filters based on organization and sub-organizations, and limits the number of TMs returned. | TMServerHelper |
Get-Container | Retrieves a container from a TM Server by its path and name, returning the container if found or $null if not. | TMServerHelper |
New-Container | Creates a new translation memory container in the TM Server using provided parameters, and returns the created container object. | TMServerHelper |
Get-ServerBasedTM | Retrieves a server-based Translation Memory (TM) from a TM server based on the provided path and name, returning the TM object. | TMServerHelper |
New-ServerBasedTM | Creates a new server-based Translation Memory (TM) on the specified TM server with provided properties, and saves it to the server. | TMServerHelper |
Remove-ServerBasedTM | Deletes a specified server-based Translation Memory (TM) from the server. | TMServerHelper |
Remove-Container | Deletes a specified Translation Memory container from the server. | TMServerHelper |
Import-Tmx | Imports TMX data into a specified File-Based or Server-Based Translation Memory. | TMServerHelper |
Export-Tmx | Exports a file-based or a server-based Translation Memory to a specified location in TMX format. | TMServerHelper |
Each function in this module has been documented with the Get-Help
cmdlet, which provides detailed information about its usage and parameters. To view the documentation for a specific function, ensure that the modules are imported into your PowerShell session.
-
Check if the Module is Loaded: Execute the following command to check if the module has been loaded
Get-Module
- This command will display all the available modules that are imported into your session
-
Retrieve Help Information: If the modules are loaded, you can retrieve the help information for a specific function by executing
Get-Help {function_name}
- Replace
{function_name}
with the name of the function you are looking for.
Windows may block files downloaded from the internet for security reasons. To ensure the toolkit functions properly, unblock the downloaded zip file.
- Open File Explorer and navigate to the folder containing the downloaded file.
- Right-click on the file to open the context menu.
- Select "Properties" from the context menu.
- In the Properties dialog, go to the "General" tab.
- Look for the message: "This file came from another computer and might be blocked to help protect this computer."
- If this message is present, check the box next to "Unblock."
- Click "Apply" to save the changes.
- Click "OK" to close the Properties dialog.
To determine which version of PowerShell is installed on your system:
-
Open the Run Dialog:
- Press
Windows Key + R
to open the Run dialog.
- Press
-
Launch PowerShell:
- Type
powershell
into the Run dialog and press Enter. This will open a PowerShell window.
- Type
-
Check the PowerShell Version:
- In the PowerShell window, enter the following command:
$PSVersionTable
- In the PowerShell window, enter the following command:
-
Press Enter. This will display a table with detailed information about the PowerShell version, including the version number
To add functionality or report bugs, please create a pull request with your changes.
Report issues here.
- Implemented
ProvidersHelper
module for managing translation provider credentials. - Updated
ToolkitInitializer
to include theProvidersHelper
module.
- Updated script to be compatible with newer versions (Trados Studio 2022 and Trados Studio 2024)
- Added
ToolkitInitializer
Module to load all modules in one function - Added help support for all the functions
- Fixed creation of FileBasedTM
- Updated script to include TM in Project
- The paths to the .dll files are now identified regardless of the operating system (32-bit of 64-bit)
- The user can select which Studio version to use (Studio4 or Studio5)
- The "Sample_Roundtrip.ps1" script now creates a sample text file with custom content
- The "Get-Project" function requires only path to the .sdlproj file as parameter
- The "New-Project" function automatically creates the source file directory
- Updated the "New-FileBasedTM" function from TMHelper module to use the new implemention from Studio
- Updated the "New-Project" function from "Sample_Roundtrip.ps1” to use the new implementation from Studio