diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2016-02-27 06:11:04 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2016-02-27 06:11:37 +0000 |
commit | e5daa2e2aef61f0b9441d19f0b67015f426c6056 (patch) | |
tree | 90a095dcd23c8a74cb605f55e224a902cba75a06 /contrib/devtools/update-translations.py | |
parent | 5c70a6d6d15cc301b76558f708948c375fe63ccb (diff) | |
parent | 317462123f8e41fd7dd967ab907e59ddffb19898 (diff) | |
download | bitcoin-e5daa2e2aef61f0b9441d19f0b67015f426c6056.tar.xz |
Merge branch 'master' into depends_curl
Diffstat (limited to 'contrib/devtools/update-translations.py')
-rwxr-xr-x | contrib/devtools/update-translations.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/contrib/devtools/update-translations.py b/contrib/devtools/update-translations.py index ea209eec7e..2b6e807b47 100755 --- a/contrib/devtools/update-translations.py +++ b/contrib/devtools/update-translations.py @@ -72,7 +72,7 @@ def sanitize_string(s): '''Sanitize string for printing''' return s.replace('\n',' ') -def check_format_specifiers(source, translation, errors): +def check_format_specifiers(source, translation, errors, numerus): source_f = split_format_specifiers(find_format_specifiers(source)) # assert that no source messages contain both Qt and strprintf format specifiers # if this fails, go change the source as this is hacky and confusing! @@ -80,10 +80,13 @@ def check_format_specifiers(source, translation, errors): try: translation_f = split_format_specifiers(find_format_specifiers(translation)) except IndexError: - errors.append("Parse error in translation '%s'" % sanitize_string(translation)) + errors.append("Parse error in translation for '%s': '%s'" % (sanitize_string(source), sanitize_string(translation))) return False else: if source_f != translation_f: + if numerus and source_f == (set(), ['n']) and translation_f == (set(), []) and translation.find('%') == -1: + # Allow numerus translations to omit %n specifier (usually when it only has one possible value) + return True errors.append("Mismatch between '%s' and '%s'" % (sanitize_string(source), sanitize_string(translation))) return False return True @@ -150,7 +153,7 @@ def postprocess_translations(reduce_diff_hacks=False): if translation is None: continue errors = [] - valid = check_format_specifiers(source, translation, errors) + valid = check_format_specifiers(source, translation, errors, numerus) for error in errors: print('%s: %s' % (filename, error)) |