1
0
Fork 0
mirror of https://github.com/YunoHost/apps.git synced 2024-09-03 20:06:07 +02:00

[enh] add script to update translations

This commit is contained in:
Laurent Peuch 2017-03-07 01:12:39 +01:00
parent 8013a5879d
commit 211d814f59

22
update_translations.py Normal file
View file

@ -0,0 +1,22 @@
import sys
import json
if __name__ == '__main__':
en = json.load(open("locales/en.json", "r"))
for builded_file in sys.argv[1:]:
builded_file = json.load(open(builded_file, "r"))
for app, data in builded_file.items():
if "en" in data["manifest"]["description"]:
key = "%s_manifest_description" % app
en[key] = data["manifest"]["description"]["en"]
for category, questions in data["manifest"]["arguments"].items():
for question in questions:
if "en" in question["ask"]:
key = "%s_manifest_arguments_%s_%s" % (app, category, question["name"])
en[key] = question["ask"]["en"]
open("locales/en.json", "w").write(json.dumps(en, sort_keys=True, indent=4))