diff --git a/.gitignore b/.gitignore index 29a3a50..cca26ba 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,5 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release + +./add_translation.py \ No newline at end of file diff --git a/add_translation.py b/add_translation.py new file mode 100644 index 0000000..3fa5fb8 --- /dev/null +++ b/add_translation.py @@ -0,0 +1,31 @@ +import re +import json + +path='./assets/translation.json' + +with open(path, 'r',encoding='utf-8') as file: + translations=json.load(file) + + +while True: + line=input() + if line=="q": + break + words=line.split('-') + if len(words)!=3: + print("invalid entry:",line,"(len(words) != 3)" + continue + en=words[0] + cn=words[1] + tw=words[2] + translations["zh_CN"][en]=cn + translations["zh_TW"][en]=tw + + +with open(path, 'w',encoding='utf-8') as file: + json.dump(translations, file, indent=2,ensure_ascii=False) + + + + +