mirror of https://github.com/x64dbg/Translations
Use GitHub Actions for crowdin sync
This commit is contained in:
parent
f196f36c5d
commit
db0ab3ebf8
|
@ -0,0 +1,49 @@
|
||||||
|
name: Translate
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 17 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update:
|
||||||
|
runs-on: windows-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout (main branch)
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Java
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: '21'
|
||||||
|
|
||||||
|
- name: Generate template
|
||||||
|
run: |
|
||||||
|
git clone --depth 1 https://github.com/x64dbg/x64dbg
|
||||||
|
cd x64dbg
|
||||||
|
mkdir bin\translations
|
||||||
|
git ls-files *.java *.jui *.ui *.c *.c++ *.cc *.cpp *.cxx *.ch *.h *.h++ *.hh *.hpp *.hxx *.js *.qs *.qml *.qrc > bin\translations\files.lst
|
||||||
|
..\lupdate.exe @bin\translations\files.lst -locations absolute -ts x64dbg.ts
|
||||||
|
Copy-Item ".\x64dbg.ts" -Destination "..\x64dbg.ts" -Force
|
||||||
|
|
||||||
|
- name: Crowdin sync
|
||||||
|
env:
|
||||||
|
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
|
||||||
|
run: |
|
||||||
|
.\crowdin-sync.bat
|
||||||
|
|
||||||
|
- name: Checkout (translations branch)
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ssh-key: ${{ secrets.UPDATE_SSH_KEY }}
|
||||||
|
ref: translations
|
||||||
|
path: translations_repo
|
||||||
|
|
||||||
|
- name: Update translations
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
run: ./update-translations.sh
|
|
@ -1,6 +1,7 @@
|
||||||
*.ts
|
*.ts
|
||||||
*.qm
|
*.qm
|
||||||
*.jar
|
|
||||||
*.zip
|
*.zip
|
||||||
*.log
|
*.log
|
||||||
translations/
|
translations/
|
||||||
|
translations_repo/
|
||||||
|
x64dbg/
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -95,7 +95,20 @@ namespace TranslationChecker
|
||||||
XmlSerializer serializer = new XmlSerializer(typeof(QtTranslations));
|
XmlSerializer serializer = new XmlSerializer(typeof(QtTranslations));
|
||||||
using (var reader = new StringReader(xml))
|
using (var reader = new StringReader(xml))
|
||||||
{
|
{
|
||||||
var test = (QtTranslations)serializer.Deserialize(reader);
|
QtTranslations test = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
test = (QtTranslations)serializer.Deserialize(reader);
|
||||||
|
}
|
||||||
|
catch (Exception x)
|
||||||
|
{
|
||||||
|
// NOTE: This can happen if there is a \r in the string to translate, like this:
|
||||||
|
// <source>Trace recording has stopped unexpectedly because WriteFile() failed. GetLastError() = %s.<byte value="xd"/>
|
||||||
|
// </ source >
|
||||||
|
Console.WriteLine($"Deserialization error with file: {tsFile}");
|
||||||
|
Console.WriteLine(x);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
using (var writer = new Utf8StringWriter())
|
using (var writer = new Utf8StringWriter())
|
||||||
using (var xw = XmlWriter.Create(writer, new XmlWriterSettings
|
using (var xw = XmlWriter.Create(writer, new XmlWriterSettings
|
||||||
{
|
{
|
||||||
|
|
Binary file not shown.
|
@ -1,22 +1,20 @@
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
echo Uploading English sources to Crowdin...
|
echo Uploading English sources to Crowdin...
|
||||||
java -jar crowdin-cli.jar upload sources --no-colors --no-progress > upload.log 2>&1
|
java -jar crowdin-cli.jar upload sources --no-colors --no-progress
|
||||||
if not %ERRORLEVEL%==0 (
|
if not %ERRORLEVEL%==0 (
|
||||||
type upload.log
|
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
|
|
||||||
echo Downloading translations from Crowdin...
|
echo Downloading translations from Crowdin...
|
||||||
rmdir /S /Q translations >nul 2>&1
|
rmdir /S /Q translations >nul 2>&1
|
||||||
java -jar crowdin-cli.jar download --no-colors --no-progress > download.log 2>&1
|
java -jar crowdin-cli.jar download --no-colors --no-progress
|
||||||
if not %ERRORLEVEL%==0 (
|
if not %ERRORLEVEL%==0 (
|
||||||
type download.log
|
|
||||||
exit /b 1
|
exit /b 1
|
||||||
)
|
)
|
||||||
|
|
||||||
echo Checking translations...
|
echo Checking translations...
|
||||||
TranslationChecker.exe translations --fix
|
TranslationChecker.exe translations
|
||||||
set CHECKER_ERRORLEVEL=%ERRORLEVEL%
|
set CHECKER_ERRORLEVEL=%ERRORLEVEL%
|
||||||
|
|
||||||
echo Generating Qt translations...
|
echo Generating Qt translations...
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cp x64dbg.ts translations/
|
||||||
|
7z a qm.zip translations/*.qm
|
||||||
|
7z a ts.zip translations/*.ts
|
||||||
|
|
||||||
|
cp translations/*.ts translations_repo/
|
||||||
|
cd translations_repo
|
||||||
|
|
||||||
|
if [ $(git status --porcelain | wc -l) -eq 0 ]; then
|
||||||
|
echo "No translation changes"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
git status
|
||||||
|
|
||||||
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git config user.name "github-actions[bot]"
|
||||||
|
|
||||||
|
git add .
|
||||||
|
git commit -m "Translation update ($(date +'%Y-%m-%dT%H:%M:%S%z'))"
|
||||||
|
git push
|
||||||
|
|
||||||
|
gh config set prompt disabled
|
||||||
|
gh release delete -y translations
|
||||||
|
gh release create --title translations --notes translations translations ../qm.zip ../ts.zip
|
Loading…
Reference in New Issue