summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-07-03 16:03:11 +0200
committerClaude Paroz <claude@2xlibre.net>2013-07-03 16:09:20 +0200
commit63b2155919c017591e70782fb0ad92167a160f30 (patch)
treef311d3a6ecdfa49feeaa4e7941dcf35408dbc0b8 /scripts
parent8a679386c3924026f8558f9cd0164890a9461e2c (diff)
Added check when fetching and updating translations from Transifex
So as syntax errors in po files don't go unnoticed. Refs #20695.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/manage_translations.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/manage_translations.py b/scripts/manage_translations.py
index 3e58040187..d1390c0181 100644
--- a/scripts/manage_translations.py
+++ b/scripts/manage_translations.py
@@ -114,6 +114,9 @@ def lang_stats(resources=None, languages=None):
if p.returncode == 0:
# msgfmt output stats on stderr
print("%s: %s" % (lang, errors.strip()))
+ else:
+ print("Errors happened when checking %s translation for %s:\n%s" % (
+ lang, name, errors))
def fetch(resources=None, languages=None):
@@ -121,6 +124,7 @@ def fetch(resources=None, languages=None):
Fetch translations from Transifex, wrap long lines, generate mo files.
"""
locale_dirs = _get_locale_dirs()
+ errors = []
for name, dir_ in locale_dirs:
if resources and not name in resources:
@@ -140,8 +144,14 @@ def fetch(resources=None, languages=None):
po_path = '%(path)s/%(lang)s/LC_MESSAGES/django%(ext)s.po' % {
'path': dir_, 'lang': lang, 'ext': 'js' if name.endswith('-js') else ''}
call('msgcat -o %s %s' % (po_path, po_path), shell=True)
- mo_path = '%s.mo' % po_path[:-3]
- call('msgfmt -o %s %s' % (mo_path, po_path), shell=True)
+ res = call('msgfmt -c -o %s.mo %s' % (po_path[:-3], po_path), shell=True)
+ if res != 0:
+ errors.append((name, lang))
+ if errors:
+ print("\nWARNING: Errors have occurred in following cases:")
+ for resource, lang in errors:
+ print("\tResource %s for language %s" % (resource, lang))
+ exit(1)
if __name__ == "__main__":