mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Updated UpdateTranslations.ps1
Changes: + Added lrelease command. + Removed .bat file + Added a simple tutorial .txt (i'm not good at Markdown if i can't look at the code without color or preview)
This commit is contained in:
parent
f3f878648b
commit
0a4bc8a8e7
3
ScreenPlay/HowToUpdateTranslations.txt
Normal file
3
ScreenPlay/HowToUpdateTranslations.txt
Normal file
@ -0,0 +1,3 @@
|
||||
Set your PowerShell execution policy using: Set-ExecutionPolicy Bypass (Run in Administrator)
|
||||
To get your current Execution Policy use: Get-ExecutionPolicy
|
||||
After that execute ./UpdateTranslations.ps1 in PowerShell and follow the tutorial.
|
@ -1,3 +0,0 @@
|
||||
@echo off
|
||||
powershell -executionpolicy bypass -File UpdateTranslations.ps1
|
||||
exit
|
@ -2,24 +2,31 @@ echo "Updating translations..."
|
||||
$MSVCPATH = Read-Host 'Type your ABSOLUTE Qt "bin" directory (ex: F:\Qt\5.15.1\msvc2019_64\bin)'
|
||||
echo "Begin update translations..."
|
||||
$files = Get-ChildItem ".\translations"
|
||||
foreach ($f in $files){
|
||||
echo "Processing $f"
|
||||
Function Execute-Command ($commandTitle, $commandPath, $commandArguments, $commandWorkDir)
|
||||
{
|
||||
$resolvedWorkDir = Resolve-Path -Path $commandWorkDir
|
||||
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
|
||||
$pinfo.FileName = "$MSVCPATH/lupdate.exe"
|
||||
$pinfo.FileName = $commandPath
|
||||
$pinfo.RedirectStandardError = $true
|
||||
$pinfo.RedirectStandardOutput = $true
|
||||
$pinfo.UseShellExecute = $false
|
||||
$pinfo.Arguments = "-extensions qml ..\qml -ts $f"
|
||||
$pinfo.WorkingDirectory = ".\translations"
|
||||
$pinfo.WorkingDirectory = $resolvedWorkDir
|
||||
$pinfo.Arguments = $commandArguments
|
||||
$p = New-Object System.Diagnostics.Process
|
||||
$p.StartInfo = $pinfo
|
||||
$p.Start() | Out-Null
|
||||
$p.WaitForExit()
|
||||
$stdout = $p.StandardOutput.ReadToEnd()
|
||||
$stderr = $p.StandardError.ReadToEnd()
|
||||
Write-Host "$stdout"
|
||||
Write-Host "$stderr"
|
||||
Write-Host "Exit code:" + $p.ExitCode
|
||||
[pscustomobject]@{
|
||||
stdout = $p.StandardOutput.ReadToEnd()
|
||||
stderr = $p.StandardError.ReadToEnd()
|
||||
ExitCode = $p.ExitCode
|
||||
}
|
||||
}
|
||||
foreach ($f in $files){
|
||||
echo "Processing $f (1/2)"
|
||||
Execute-Command -commandTitle "Process translation file: $f" -commandPath "$MSVCPATH\lupdate.exe" -commandArguments "-extensions qml ..\qml -ts $f" -commandWorkDir "translations"
|
||||
echo "Processing $f (2/2)"
|
||||
Execute-Command -commandTitle "Process translation file: $f" -commandPath "$MSVCPATH\lrelease.exe" -commandArguments "$f" -commandWorkDir "translations"
|
||||
echo "Done"
|
||||
}
|
||||
echo "Updated translations."
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
ScreenPlay/translations/ScreenPlay_zh-CN.qm
Normal file
BIN
ScreenPlay/translations/ScreenPlay_zh-CN.qm
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user