mirror of
https://github.com/dogecoin/dogecoin.git
synced 2026-01-31 10:30:52 +00:00
add numerus format check to check-translations.py (translation linter)
Cherry-picked from: b4d92e10 Github Pull Request: #3446
This commit is contained in:
parent
3759e0f3d1
commit
35f7d17c3e
@ -130,9 +130,23 @@ def check_all_translations():
|
||||
# pick all numerusforms
|
||||
if numerus:
|
||||
translations = [i.text for i in translation_node.findall('numerusform')]
|
||||
if len(translations) == 0:
|
||||
print(f'Numerus message without numerusform translations, needs fix.', sanitize_string(source))
|
||||
have_errors = True
|
||||
if translation_node.text is not None and not translation_node.text.isspace():
|
||||
print(f'Numerus message contains extra text {translation_node.text}, needs fix.')
|
||||
have_errors = True
|
||||
for child in list(translation_node.iter())[1:]: # exclude root
|
||||
if child.tag != 'numerusform':
|
||||
print('Numerus message contains extra child node, needs fix.', sanitize_string(source))
|
||||
have_errors = True
|
||||
break
|
||||
else:
|
||||
translations = [translation_node.text]
|
||||
|
||||
if len(list(translation_node.iter())) != 1:
|
||||
print('Non-numerus message contains child node in translation, needs fix.', sanitize_string(source))
|
||||
have_errors = True
|
||||
|
||||
for translation in translations:
|
||||
if translation is None:
|
||||
continue
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user