Skip to content

Commit 34bfc7e

Browse files
committed
Adding translation testing to our GitHub actions CI... to make language translation failures more visible.
1 parent a38ff7e commit 34bfc7e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

.github/workflows/ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ jobs:
2828

2929
- name: Test
3030
run: python3 ./src/tests/query_tests.py -platform minimal
31+
32+
- name: Translation Test
33+
run: python3 ./src/language/test_translations.py

src/language/test_translations.py

+6
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
red='\033[31m'
4141
endc='\033[0m'
4242

43+
found_errors = False
44+
4345
# Get app instance
4446
app = QCoreApplication(sys.argv)
4547

@@ -68,8 +70,12 @@
6870
if "%s" in source_string or "%s(" in source_string or "%d" in source_string:
6971
translated_string = app.translate("", source_string)
7072
if source_string.count('%') != translated_string.count('%'):
73+
found_errors = True
7174
print(red, '\tInvalid string replacement found: "%s" vs "%s" [%s]' %
7275
(translated_string, source_string, lang_code), endc)
7376

7477
# Remove translator
7578
app.removeTranslator(translator)
79+
80+
if found_errors:
81+
raise(Exception("Errors detected during translation testing! See above."))

0 commit comments

Comments
 (0)