mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Updated language statistics script to not use the shell
This commit is contained in:
parent
728ee98cd3
commit
b679b5b8f2
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user