mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
Add support for multiple files in scripts/reconvert_l10n.py
This commit is contained in:
parent
3968d13df9
commit
0b35fa67da
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue