Add support for multiple files in scripts/reconvert_l10n.py

This commit is contained in:
heinrich5991 2014-06-21 19:23:27 +02:00 committed by oy
parent 3968d13df9
commit 0b35fa67da

View file

@ -1,14 +1,13 @@
import json
import polib
import sys
JSON_KEY_TRANSL="translated strings"
JSON_KEY_OR="or"
JSON_KEY_TR="tr"
JSON_KEY_CO="context"
if __name__ == '__main__':
po = polib.pofile(open(sys.argv[1], encoding='utf-8').read())
def reconvert(filename):
po = polib.pofile(open(filename, encoding='utf-8').read())
translations = []
for entry in po:
@ -24,9 +23,14 @@ if __name__ == '__main__':
json.dump(
result,
open(sys.argv[1] + '.json', 'w', encoding='utf-8'),
open(filename + '.json', 'w', encoding='utf-8'),
ensure_ascii=False,
indent="\t",
separators=(',', ': '),
sort_keys=True,
)
if __name__ == '__main__':
import sys
for filename in sys.argv[1:]:
reconvert(filename)