Skip to content

Commit 468b2cd

Browse files
committed
Use GitHub Actions for crowdin sync
1 parent f196f36 commit 468b2cd

File tree

10 files changed

+70
-7
lines changed

10 files changed

+70
-7
lines changed

.github/workflows/translate.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Translate
2+
on: [push]
3+
4+
jobs:
5+
update:
6+
runs-on: windows-latest
7+
permissions:
8+
contents: write
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
- uses: actions/setup-java@v4
14+
with:
15+
distribution: 'temurin'
16+
java-version: '21'
17+
18+
- name: Generate template
19+
run: |
20+
git clone https://github.com/x64dbg/translations --branch translations
21+
git clone --depth 1 https://github.com/x64dbg/x64dbg
22+
cd x64dbg
23+
mkdir bin\translations
24+
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
25+
..\lupdate.exe @bin\translations\files.lst -locations absolute -ts x64dbg.ts
26+
Copy-Item ".\x64dbg.ts" -Destination "..\x64dbg.ts" -Force
27+
28+
- name: Crowdin sync
29+
env:
30+
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
31+
run: |
32+
.\crowdin-sync.bat
33+
34+
- name: Push translations
35+
shell: bash
36+
run: cd translations && ./update.sh
37+
38+
- name: Upload Qt translations
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: translations-qm
42+
path: translations/*.qm
43+
44+
- name: Upload crowdin translations
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: translations-ts
48+
path: translations/*.ts
49+
50+
51+
52+

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
*.ts
22
*.qm
3-
*.jar
43
*.zip
54
*.log
65
translations/
6+
x64dbg/

Qt5Core.dll

5.7 MB
Binary file not shown.

Qt5Xml.dll

198 KB
Binary file not shown.

TranslationChecker.exe

1 KB
Binary file not shown.

TranslationChecker/TranslationChecker/Program.cs

+14-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,20 @@ static bool CheckSerialize(string tsFile)
9595
XmlSerializer serializer = new XmlSerializer(typeof(QtTranslations));
9696
using (var reader = new StringReader(xml))
9797
{
98-
var test = (QtTranslations)serializer.Deserialize(reader);
98+
QtTranslations test = null;
99+
try
100+
{
101+
test = (QtTranslations)serializer.Deserialize(reader);
102+
}
103+
catch (Exception x)
104+
{
105+
// NOTE: This can happen if there is a \r in the string to translate, like this:
106+
// <source>Trace recording has stopped unexpectedly because WriteFile() failed. GetLastError() = %s.<byte value="xd"/>
107+
// </ source >
108+
Console.WriteLine($"Deserialization error with file: {tsFile}");
109+
Console.WriteLine(x);
110+
return false;
111+
}
99112
using (var writer = new Utf8StringWriter())
100113
using (var xw = XmlWriter.Create(writer, new XmlWriterSettings
101114
{

crowdin-cli.jar

6.41 MB
Binary file not shown.

crowdin-sync.bat

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
@echo off
22

33
echo Uploading English sources to Crowdin...
4-
java -jar crowdin-cli.jar upload sources --no-colors --no-progress > upload.log 2>&1
4+
java -jar crowdin-cli.jar upload sources --no-colors --no-progress
55
if not %ERRORLEVEL%==0 (
6-
type upload.log
76
exit /b 1
87
)
98

109
echo Downloading translations from Crowdin...
1110
rmdir /S /Q translations >nul 2>&1
12-
java -jar crowdin-cli.jar download --no-colors --no-progress > download.log 2>&1
11+
java -jar crowdin-cli.jar download --no-colors --no-progress
1312
if not %ERRORLEVEL%==0 (
14-
type download.log
1513
exit /b 1
1614
)
1715

1816
echo Checking translations...
19-
TranslationChecker.exe translations --fix
17+
TranslationChecker.exe translations
2018
set CHECKER_ERRORLEVEL=%ERRORLEVEL%
2119

2220
echo Generating Qt translations...

lrelease.exe

377 KB
Binary file not shown.

lupdate.exe

730 KB
Binary file not shown.

0 commit comments

Comments
 (0)