1
0
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:
teppyboy 2020-10-04 21:40:59 +07:00
parent f3f878648b
commit 0a4bc8a8e7
11 changed files with 20 additions and 13 deletions

View 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.

View File

@ -1,3 +0,0 @@
@echo off
powershell -executionpolicy bypass -File UpdateTranslations.ps1
exit

View File

@ -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.