translation: added script for converting to JSON for poeditor.com import
Dieser Commit ist enthalten in:
Ursprung
43a8713047
Commit
b805e2fa78
20
utils/locale2json.py
Normale Datei
20
utils/locale2json.py
Normale Datei
@ -0,0 +1,20 @@
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
import codecs
|
||||
from traintastic import read_locale_file
|
||||
|
||||
|
||||
def to_json(filename_txt, filename_json):
|
||||
(strings, header, garbage) = read_locale_file(filename_txt)
|
||||
out = []
|
||||
for s in strings:
|
||||
if not s['hash']:
|
||||
out.append({'term': s['id'], 'definition': s['value']})
|
||||
with codecs.open(filename_json, 'w', 'utf-8') as f:
|
||||
json.dump(out, f, indent=' ')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
for f in sys.argv[1:]:
|
||||
to_json(f, os.path.splitext(f)[0] + '.json')
|
||||
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren