summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2018-08-31 14:18:04 +0200
committerClaude Paroz <claude@2xlibre.net>2018-08-31 14:18:55 +0200
commitb679b5b8f29cd4047a623e81999488043733d370 (patch)
tree368379789c395852c122f4e85a0c811e19b44fcc /scripts
parent728ee98cd39df4a1d0e209c81f36dd6852b2a3a5 (diff)
downloaddjango-b679b5b8f29cd4047a623e81999488043733d370.tar.gz
Updated language statistics script to not use the shell
Diffstat (limited to 'scripts')
-rw-r--r--scripts/manage_translations.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/scripts/manage_translations.py b/scripts/manage_translations.py
index 5397d35bae..de38a470b1 100644
--- a/scripts/manage_translations.py
+++ b/scripts/manage_translations.py
@@ -119,16 +119,21 @@ def lang_stats(resources=None, languages=None):
if languages and lang not in languages:
continue
# TODO: merge first with the latest en catalog
- p = Popen("msgfmt -vc -o /dev/null %(path)s/%(lang)s/LC_MESSAGES/django%(ext)s.po" % {
- 'path': dir_, 'lang': lang, 'ext': 'js' if name.endswith('-js') else ''},
- stdout=PIPE, stderr=PIPE, shell=True)
+ po_path = '{path}/{lang}/LC_MESSAGES/django{ext}.po'.format(
+ path=dir_, lang=lang, ext='js' if name.endswith('-js') else ''
+ )
+ p = Popen(
+ ['msgfmt', '-vc', '-o', '/dev/null', po_path],
+ stdout=PIPE, stderr=PIPE,
+ env={'LANG': 'C'}
+ )
output, errors = p.communicate()
if p.returncode == 0:
# msgfmt output stats on stderr
- print("%s: %s" % (lang, errors.strip()))
+ print("%s: %s" % (lang, errors.decode().strip()))
else:
print("Errors happened when checking %s translation for %s:\n%s" % (
- lang, name, errors))
+ lang, name, errors.decode()))
def fetch(resources=None, languages=None):