mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48: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 json
|
||||||
import polib
|
import polib
|
||||||
import sys
|
|
||||||
|
|
||||||
JSON_KEY_TRANSL="translated strings"
|
JSON_KEY_TRANSL="translated strings"
|
||||||
JSON_KEY_OR="or"
|
JSON_KEY_OR="or"
|
||||||
JSON_KEY_TR="tr"
|
JSON_KEY_TR="tr"
|
||||||
JSON_KEY_CO="context"
|
JSON_KEY_CO="context"
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def reconvert(filename):
|
||||||
po = polib.pofile(open(sys.argv[1], encoding='utf-8').read())
|
po = polib.pofile(open(filename, encoding='utf-8').read())
|
||||||
translations = []
|
translations = []
|
||||||
|
|
||||||
for entry in po:
|
for entry in po:
|
||||||
|
@ -24,9 +23,14 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
json.dump(
|
json.dump(
|
||||||
result,
|
result,
|
||||||
open(sys.argv[1] + '.json', 'w', encoding='utf-8'),
|
open(filename + '.json', 'w', encoding='utf-8'),
|
||||||
ensure_ascii=False,
|
ensure_ascii=False,
|
||||||
indent="\t",
|
indent="\t",
|
||||||
separators=(',', ': '),
|
separators=(',', ': '),
|
||||||
sort_keys=True,
|
sort_keys=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import sys
|
||||||
|
for filename in sys.argv[1:]:
|
||||||
|
reconvert(filename)
|
||||||
|
|
Loading…
Reference in a new issue