1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Removed source strings from translated po files

Forward port of 05a781a47 from stable/1.8.x
This commit is contained in:
Claude Paroz 2015-04-01 14:42:04 +02:00
parent a184a99123
commit dda1f7bff7

View File

@ -138,21 +138,22 @@ def fetch(resources=None, languages=None):
# Transifex pull # Transifex pull
if languages is None: if languages is None:
call('tx pull -r %(res)s -a -f --minimum-perc=5' % {'res': _tx_resource_for_name(name)}, shell=True) call('tx pull -r %(res)s -a -f --minimum-perc=5' % {'res': _tx_resource_for_name(name)}, shell=True)
languages = sorted([d for d in os.listdir(dir_) if not d.startswith('_') and d != 'en']) target_langs = sorted([d for d in os.listdir(dir_) if not d.startswith('_') and d != 'en'])
else: else:
for lang in languages: for lang in languages:
call('tx pull -r %(res)s -f -l %(lang)s' % { call('tx pull -r %(res)s -f -l %(lang)s' % {
'res': _tx_resource_for_name(name), 'lang': lang}, shell=True) 'res': _tx_resource_for_name(name), 'lang': lang}, shell=True)
target_langs = languages
# msgcat to wrap lines and msgfmt for compilation of .mo file # msgcat to wrap lines and msgfmt for compilation of .mo file
for lang in languages: for lang in target_langs:
po_path = '%(path)s/%(lang)s/LC_MESSAGES/django%(ext)s.po' % { po_path = '%(path)s/%(lang)s/LC_MESSAGES/django%(ext)s.po' % {
'path': dir_, 'lang': lang, 'ext': 'js' if name.endswith('-js') else ''} 'path': dir_, 'lang': lang, 'ext': 'js' if name.endswith('-js') else ''}
if not os.path.exists(po_path): if not os.path.exists(po_path):
print("No %(lang)s translation for resource %(name)s" % { print("No %(lang)s translation for resource %(name)s" % {
'lang': lang, 'name': name}) 'lang': lang, 'name': name})
continue continue
call('msgcat -o %s %s' % (po_path, po_path), shell=True) call('msgcat --no-location -o %s %s' % (po_path, po_path), shell=True)
res = call('msgfmt -c -o %s.mo %s' % (po_path[:-3], po_path), shell=True) res = call('msgfmt -c -o %s.mo %s' % (po_path[:-3], po_path), shell=True)
if res != 0: if res != 0:
errors.append((name, lang)) errors.append((name, lang))