[i18] Fix the translation script
parent
40c8e63ee3
commit
3e0c2f60f9
|
@ -1,8 +1,9 @@
|
||||||
[main]
|
[main]
|
||||||
host = https://www.transifex.com
|
host = https://www.transifex.com
|
||||||
lang_map = sr@latin:sr_Latn, zh_CN:zh_Hans, zh_TW:zh_Hant
|
lang_map = sr@latin:sr-latn, zh-Hans:zh-hans, zh-Hant:zh-hant
|
||||||
|
|
||||||
[taiga-front.locale-enjson]
|
[taiga-front.locale-enjson]
|
||||||
file_filter = app/locales/locale-<lang>.json
|
file_filter = app/locales/locale-<lang>.json
|
||||||
source_file = app/locales/locale-en.json
|
source_file = app/locales/locale-en.json
|
||||||
source_lang = en
|
source_lang = en
|
||||||
|
type = KEYVALUEJSON
|
||||||
|
|
|
@ -26,12 +26,6 @@ from argparse import RawTextHelpFormatter
|
||||||
from subprocess import PIPE, Popen, call
|
from subprocess import PIPE, Popen, call
|
||||||
|
|
||||||
|
|
||||||
FIXED_LOCALES = {
|
|
||||||
"zh-Hant": "zh-hant",
|
|
||||||
"zh-Hans": "zh-hans"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def _tx_resource_for_name(name):
|
def _tx_resource_for_name(name):
|
||||||
""" Return the Transifex resource name """
|
""" Return the Transifex resource name """
|
||||||
return "taiga-front.{}".format(name)
|
return "taiga-front.{}".format(name)
|
||||||
|
@ -41,11 +35,6 @@ def fetch(resources=None, languages=None):
|
||||||
"""
|
"""
|
||||||
Fetch translations from Transifex.
|
Fetch translations from Transifex.
|
||||||
"""
|
"""
|
||||||
for lang, lang_fixed in FIXED_LOCALES.items():
|
|
||||||
if os.path.exists("app/locales/locale-{}.json".format(lang_fixed)):
|
|
||||||
os.rename("app/locales/locale-{}.json".format(lang_fixed),
|
|
||||||
"app/locales/locale-{}.json".format(lang))
|
|
||||||
|
|
||||||
if not resources:
|
if not resources:
|
||||||
if languages is None:
|
if languages is None:
|
||||||
call("tx pull -f --minimum-perc=5", shell=True)
|
call("tx pull -f --minimum-perc=5", shell=True)
|
||||||
|
@ -63,11 +52,6 @@ def fetch(resources=None, languages=None):
|
||||||
call("tx pull -r {res} -f -l {lang}".format(res=_tx_resource_for_name(resource), lang=lang),
|
call("tx pull -r {res} -f -l {lang}".format(res=_tx_resource_for_name(resource), lang=lang),
|
||||||
shell=True)
|
shell=True)
|
||||||
|
|
||||||
for lang, lang_fixed in FIXED_LOCALES.items():
|
|
||||||
if os.path.exists("app/locales/locale-{}.json".format(lang)):
|
|
||||||
os.rename("app/locales/locale-{}.json".format(lang),
|
|
||||||
"app/locales/locale-{}.json".format(lang_fixed))
|
|
||||||
|
|
||||||
|
|
||||||
def commit(resources=None, languages=None):
|
def commit(resources=None, languages=None):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue