forked from YunoHost/apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_translations.py
27 lines (20 loc) · 1.1 KB
/
update_translations.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sys
import json
if __name__ == '__main__':
for builded_file in sys.argv[1:]:
app_list = builded_file.split("-")[0]
en = json.load(open("locales-%s/en.json" % app_list, "r"))
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"]
if "en" in question.get("help", {}):
key = "%s_manifest_arguments_%s_help_%s" % (app, category, question["name"])
en[key] = question["help"]["en"]
open("locales-%s/en.json" % app_list, "w").write(json.dumps(en, sort_keys=True, indent=4))