Skip to content

Commit

Permalink
Add support for Studio 2019
Browse files Browse the repository at this point in the history
  • Loading branch information
EvzenP committed Jun 28, 2018
1 parent f714c7a commit 8d73780
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 10 deletions.
9 changes: 5 additions & 4 deletions Modules/ProjectHelper/ProjectHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ Add-Type -Path "$ProgramFilesDir\SDL\SDL Trados Studio\$StudioVersion\Sdl.Projec
# Due to API bug basing new projects on "Default.sdltpl" template instead of actual default project template,
# we need to find the real default template configured in Trados Studio by reading the configuration files
switch ($StudioVersion) {
"Studio2" {$StudioVersionAppData = "10.0.0.0"}
"Studio3" {$StudioVersionAppData = "11.0.0.0"}
"Studio4" {$StudioVersionAppData = "12.0.0.0"}
"Studio5" {$StudioVersionAppData = "14.0.0.0"}
"Studio2" {$StudioVersionAppData = "10.0.0.0"}
"Studio3" {$StudioVersionAppData = "11.0.0.0"}
"Studio4" {$StudioVersionAppData = "12.0.0.0"}
"Studio5" {$StudioVersionAppData = "14.0.0.0"}
"Studio15" {$StudioVersionAppData = "15.0.0.0"}
}
# Get default project template GUID from the user settings file
$DefaultProjectTemplateGuid = (Select-Xml -Path "${Env:AppData}\SDL\SDL Trados Studio\$StudioVersionAppData\UserSettings.xml" -XPath "//Setting[@Id='DefaultProjectTemplateGuid']").Node.InnerText
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ That's all... the kit is now ready for use!
## Usage
### In Windows batch script
Call the wrapper script with desired action command and its parameters as command line arguments:
`call TS2015 New-Project -Name "My project" -Location "D:\My project" ...`
`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\TS2015.cmd" New-Project -Name "My project" -Location "D:\My project" ...`
`call "C:\My scripts\TS2017.cmd" New-Project -Name "My project" -Location "D:\My project" ...`

### In Powershell script
Call the desired PowerShell function with corresponding parameters directly from your PowerShell script:
Expand All @@ -78,7 +78,7 @@ Target languages list for "CreateProject", "ExportPackages" and "ExportFiles" sc
@echo off
set TARGETLANGUAGES=%~1
for %%D in ("%CD%") do set "PROJECTNAME=%%~nxD"
call TS2015 New-Project ^
call TS2017 New-Project ^
-Name "%PROJECTNAME%" ^
-SourceLocation "02_Prep" ^
-ProjectLocation "03_Studio" ^
Expand All @@ -92,7 +92,7 @@ call TS2015 New-Project ^
```
@echo off
set TARGETLANGUAGES=%~1
call TS2015 Export-Package ^
call TS2017 Export-Package ^
-ProjectLocation "03_Studio" ^
-PackageLocation "04_ForTrans" ^
-TargetLanguages "%TARGETLANGUAGES%" ^
Expand All @@ -101,15 +101,15 @@ call TS2015 Export-Package ^
==05_ImportPackages.cmd==:
```
@echo off
call TS2015 Import-Package ^
call TS2017 Import-Package ^
-ProjectLocation "03_Studio" ^
-PackageLocation "05_FromTrans"
```
==06_ExportFiles.cmd==:
```
@echo off
set TARGETLANGUAGES=%~1
call TS2015 Export-TargetFiles ^
call TS2017 Export-TargetFiles ^
-ProjectLocation "03_Studio" ^
-ExportLocation "06_Post" ^
-TargetLanguages "%TARGETLANGUAGES%"
Expand Down Expand Up @@ -139,6 +139,9 @@ https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/1597627
https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/11088702-start-process-doesn-t-work-if-in-a-directory-name

## Version history
### STraSAK v1.4       (2018-06-29)
* Added support for Studio 2019

### STraSAK v1.3       (2018-02-04)
* **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 of `Analyze Files en-US_de-DE.log`)*

Expand Down
Binary file modified STraSAK.pdf
Binary file not shown.
33 changes: 33 additions & 0 deletions TS2019.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<# : ----------------- begin batch part -----------------
@echo off

:: get Documents folder location from registry
for /f "tokens=2*" %%A in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Personal" 2^>nul') do call set "DocumentsFolder=%%B"
:: add Modules location to PSModulePath variable
set "PSModulePath=%DocumentsFolder%\WindowsPowerShell\Modules\;%PSModulePath%"

:: PowerShell location
set POWERSHELL=%windir%\system32\WindowsPowerShell\v1.0\powershell.exe
:: use 32-bit version on 64-bit systems!
if exist "%windir%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe" (set POWERSHELL=%windir%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe)

:: from http://www.dostips.com/forum/viewtopic.php?f=3&t=5526&start=15#p45502
:: invoke embedded PowerShell code + code specified on command line
setlocal enabledelayedexpansion
set _args=%*
rem this is to prevent PS errors if launched with empty command line
if not defined _args set "_args= "
set _args=!_args:'=''!
set _args=!_args:"="""!
type "%~f0" | %POWERSHELL% -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "%POWERSHELL% -NoLogo -NoProfile -ExecutionPolicy Bypass -Command ([ScriptBlock]::Create([Console]::In.ReadToEnd()+';!_args!'))"
endlocal

exit /b 0
----------------- end batch part ----------------- #>

[cultureinfo]::DefaultThreadCurrentCulture = 'en-US'

# import SDL Powershell Toolkit modules
$StudioVersion = "Studio15"
$Modules = @("TMHelper","ProjectHelper","GetGuids","PackageHelper")
ForEach ($Module in $Modules) {Import-Module -Name $Module -ArgumentList $StudioVersion}

0 comments on commit 8d73780

Please sign in to comment.