In localization engineer's daily work, many projects use more-or-less fixed process and structure:
- master TMs are stored in a fixed location
- individual handoffs use fixed (sub)folders structure (location of the prepared source files is known, location where the Trados Studio project should be created is known, etc...)
- Trados Studio projects naming follows certain pattern, e.g. {client_name}_{current_date}_{handoff_name}
- source language is (almost) always the same... target languages are also often the same...
- and so on...
So... it should not be necessary to enter manually all these parameters required for Trados Studio operations over and over again... some script should be able to use all this known data and do everything automatically.
And that's the purpose of this automation kit – to allow engineers to automate Trados-related operation using simple scriptable commands:
Command | Description |
---|---|
New-Project | Create new project – optionally based on project template or another project – in specified location, using specified source and target languages and TMs from specified location. Get source files from specified location and automatically convert them to translatable format and copy them to target languages. Optionally also pre-translate and analyze the files, saving results to Trados 2007-formatted log. |
PseudoTranslate | Pseudo-translate specified project, using specified pseudo-translation options. Optionally also export the pseudo-translated target files. |
Export-Package | Create translation packages from specified project, using specified package options, and save them to specified location |
Import-Package | Import return packages from specified location in a specified project |
ConvertTo-TradosLog | Convert Studio XML-based report to Trados 2007-formatted log |
Export-TargetFiles | Export target files from specified project to specified location |
Update-MainTMs | Update main translation memories of specified project |
New-FileBasedTM | Create new translation memory in specified location, using specified options |
Export-TMX | Export one or more Trados Studio translation memories to TMX, optionally applying a filter |
Import-TMX | Import content from TMX file in a specified TM, optionally applying a filter |
Automation is based on SDL PowerShell Toolkit (https://github.com/sdl/Sdl-studio-powershell-toolkit) with own extensive enhancements and customizations. The kit consists of:
- PowerShell modules containing the actual automation
- Windows batch wrapper/launcher script for easy invocation of the PowerShell functions from command line
- PDF manual with detailed description of functions, their parameters and usage examples
- Pre-requisite: Windows PowerShell 4.0 or newer installed
This may be required only for Windows 7 and 8.
Windows 8.1 has PowerShell 4.0 already built-in, Windows 10 has PowerShell 5.0 already built-in.
Download Powershell 4.0: https://www.microsoft.com/en-us/download/details.aspx?id=40855
Download Powershell 5.1: https://www.microsoft.com/en-us/download/details.aspx?id=54616 - Create
WindowsPowerShell
subfolder in yourDocuments
folder
(i.e. the result will beC:\Users\<YourProfile>\Documents\WindowsPowerShell
)
NOTE: If you moved your Documents folder to another location, create the subfolder in that location. - Copy the entire
Modules
folder (including the folder structure) into the createdWindowsPowerShell
folder. - Put the
TS2015.cmd
(TS2017.cmd
,TS2019.cmd
) wrapper script to any preferred location and add the location to your PATH environment variable, so that you can run the script without specifying its full path.
See https://www.java.com/en/download/help/path.xml for more information about PATH variable and how to edit its content in different operating systems.
Note: Make sure to add the location to the existing value of PATH (separated by semicolon)... do not replace the existing value, otherwise some applications or your system may stop working properly!
Optionally you can put the wrapper script to a location which is already listed in the PATH variable (e.g.C:\WINDOWS
)... but that may be uncomfortable, depeding on particular system setup, etc.
That's all... the kit is now ready for use!
Call the wrapper script with desired action command and its parameters as command line arguments:
call TS2017 New-Project -Name "My project" -Location "D:\My project" ...
If the wrapper script's location is not listed in PATH environment variable, you need to use full path to script:
call "C:\My scripts\TS2017.cmd" New-Project -Name "My project" -Location "D:\My project" ...
Call the desired PowerShell function with corresponding parameters directly from your PowerShell script:
New-Project -Name "My project" -Location "D:\Projects\My project" ...
Use the language's appropriate method to call either the batch wrapper, or the PowerShell function.
Here is a few Windows batch scripts as examples of automation implementation.
Target languages list for "CreateProject", "ExportPackages" and "ExportFiles" scripts is passed as script parameter, e.g.:
03_CreateProject.cmd "de-DE fr-FR it-IT"
(language codes can be separated by space, comma or pipe)
== 03_CreateProject.cmd ==
@echo off
set TARGETLANGUAGES=%~1
for %%D in ("%CD%") do set "PROJECTNAME=%%~nxD"
call TS2017 New-Project ^
-Name "%PROJECTNAME%" ^
-SourceLocation "02_Prep" ^
-ProjectLocation "03_Studio" ^
-LogLocation "04_ForTrans" ^
-TargetLanguages "%TARGETLANGUAGES%" ^
-TMLocation "X:\Projects\My Project\_TMs" ^
-ProjectTemplate "X:\Projects\My Project\_Template\MyProject.sdltpl" ^
-Pretranslate -Analyze
== 04_ExportPackages.cmd ==
@echo off
set TARGETLANGUAGES=%~1
call TS2017 Export-Package ^
-ProjectLocation "03_Studio" ^
-PackageLocation "04_ForTrans" ^
-TargetLanguages "%TARGETLANGUAGES%" ^
-IncludeMainTMs -IncludeTermbases
== 05_ImportPackages.cmd ==
@echo off
call TS2017 Import-Package ^
-ProjectLocation "03_Studio" ^
-PackageLocation "05_FromTrans"
== 06_ExportFiles.cmd ==
@echo off
set TARGETLANGUAGES=%~1
call TS2017 Export-TargetFiles ^
-ProjectLocation "03_Studio" ^
-ExportLocation "06_Post" ^
-TargetLanguages "%TARGETLANGUAGES%"
This is Trados Studio API bug. It's just a cosmetic issue and does not influence automation functionality.
This seems to be caused by some weird memory leak in Studio API if a huge TM is used for analysis or for creating Project TM (either during project creation, or when a "Create new TM" package creation option is used), which may cause Out Of Memory exception.
As a workaround you can try the -PerLanguage
parameter of the New-Project
function. Or you can try to use smaller/less TMs. Or both...
This is PowerShell bug and there is currently no reasonable workaround... except for removing there characters from folder/file names.
You can vote for fixing this bug at following links:
https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/15976273-powershell-fails-to-start-if-path-contains-bracket
- Added support for Studio 2021
- Improved detection of default project template (it works now correctly with Studio 2019 SR1 and newer, which broke the way it worked reliably for years :( )
- Import-TMX command now displays separate progress information for each import phase
- Import-TMX and Export-TMX commands can now apply filter during import/export
- fixed
Multiple ambiguous overloads found
errors and no progress information displayed during TMX import/export with Studio 2017 SR1 CU13 and newer - progress information is now displayed also for Pre-translate Files and Analyze Files automatic tasks
- New-FilebasedTM now optionally returns created TM object(s) using -PassThru switch
- TM helper functions (
Get-TM...
) now accept also TM object as input, apart from TM file - internal refactoring
- New-FileBasedTM command can now create multiple TMs at once
- Added support for Studio 2019
- New-Project: fixed v1.2 bug causing source language code missing in created Trados log file names (e.g.
Analyze Files de-DE.log
instead ofAnalyze Files en-US_de-DE.log
)
- Export-Package: fixed bug causing Project TM (and analysis report) not being included in created translation package when "Create new project TM" option was used
- Export-Package: added
Recompute
andIncludeExisting
aliases forRecomputeAnalysis
andIncludeExistingReports
parameters - Export-TargetFiles: added
Export
alias forExportLocation
parameter, to be consistent with pseudotranslation parameters
- Added PseudoTranslate command
- added New-Project command features:
- can also apply PerfectMatch during project creation (with automatic matching of bilingual files)
- can also save analysis logs to Excel format
- can run in special "per-language mode" when tasks (pretranslation, analysis, etc.) are run separately for each language – see more info in manual
- added/changed ConvertTo-TradosLog command features:
- can now convert all logs in folder (incl. subfolders, if needed)
- can now specify output file name and location when converting single file
- new Update-MainTMs command which does exactly what it says ;-)
- new New-FileBasedTM command for quick creation of empty TMs
- new Import-TMX command for quick TMX import to TM
- new Export-TMX command for quick TMX export
- can export all TMs in folder, incl. subfolders if needed
- changed Import-Package command feature
- now does not search input folder recursively by default
- separate
-Recurse
switch added to search for packages also in subfolders
- improved progress messages
- internal fuzzies now correctly included in Trados 2007 textual logs
- Studio project creation, including pre-translation, analysis and textual logs export
- translation packages creation
- return packages import
- target files export
Basic project creation functionality