diff options
author | Patrick Griffis <tingping@tingping.se> | 2018-04-04 18:48:59 -0400 |
---|---|---|
committer | Patrick Griffis <tingping@tingping.se> | 2018-04-04 19:14:59 -0400 |
commit | 93cc105a40e3d3d71ba12fb344f6dee4eaeb3807 (patch) | |
tree | 33a7e36dd0788590b778a53cbe22e0ac61c0ece2 /po | |
parent | 33300630a3653cb47ccdd0d0096d22e277417db2 (diff) |
travis: Avoid locale problems
Diffstat (limited to 'po')
-rwxr-xr-x | po/validate-textevent-translations | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/po/validate-textevent-translations b/po/validate-textevent-translations index c61f9413..e719d3aa 100755 --- a/po/validate-textevent-translations +++ b/po/validate-textevent-translations @@ -7,21 +7,29 @@ import sys ret = 0 +def log(prefix, suffix, fallback): + try: + print(prefix, suffix) # Non-utf8 output... + except UnicodeEncodeError: + print(prefix, fallback) + + def validate_translation(input, translation): if not translation: return True if re.findall(r'(?:(?<!%)%[^%OCRUHBIH]|\$[^at1234])', translation): - print('Translation includes invalid formatting:', translation) + log('Translation includes invalid formatting:', translation, input) + return False in_vars = re.findall(r'(\$(?:\d|t))', input) if not all(var in translation for var in in_vars): - print('Translation does not contain all variables:', translation) + log('Translation does not contain all variables:', translation, input) return False in_ascii = re.findall(r'\$a(\d{3})', translation) if any(int(i) > 256 for i in in_ascii): - print('Translation contains invalid ascii value:') + log('Translation contains invalid ascii value:', translation, input) return False # We could try to validate colors but that is pretty flexible |