Skip to content

Commit ff8f573

Browse files
Merge pull request dogecoin#3446 from slightlyskepticalpotat/1.14.7-dev
check numerus format in check-translations.py
2 parents 5a23f00 + b4d92e1 commit ff8f573

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

contrib/devtools/check-translations.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,23 @@ def check_all_translations():
130130
# pick all numerusforms
131131
if numerus:
132132
translations = [i.text for i in translation_node.findall('numerusform')]
133+
if len(translations) == 0:
134+
print(f'Numerus message without numerusform translations, needs fix.', sanitize_string(source))
135+
have_errors = True
136+
if translation_node.text is not None and not translation_node.text.isspace():
137+
print(f'Numerus message contains extra text {translation_node.text}, needs fix.')
138+
have_errors = True
139+
for child in list(translation_node.iter())[1:]: # exclude root
140+
if child.tag != 'numerusform':
141+
print('Numerus message contains extra child node, needs fix.', sanitize_string(source))
142+
have_errors = True
143+
break
133144
else:
134145
translations = [translation_node.text]
135-
146+
if len(list(translation_node.iter())) != 1:
147+
print('Non-numerus message contains child node in translation, needs fix.', sanitize_string(source))
148+
have_errors = True
149+
136150
for translation in translations:
137151
if translation is None:
138152
continue

0 commit comments

Comments
 (0)