2020-10-15 18:37:36 +00:00
|
|
|
import zipfile
|
|
|
|
import json
|
|
|
|
|
|
|
|
lang_crowdin = {
|
|
|
|
'ar': 'ar_ar',
|
|
|
|
'de': 'de_de',
|
|
|
|
'el': 'el_gr',
|
|
|
|
'es-ES': 'es_es',
|
|
|
|
'fa': 'fa_ir',
|
|
|
|
'fil': 'fil_ph',
|
|
|
|
'fr': 'fr_fr',
|
|
|
|
'he': 'he_il',
|
|
|
|
'hr': 'hr_hr',
|
|
|
|
'id': 'id_id',
|
|
|
|
'it': 'it_id',
|
|
|
|
'ko': 'ko_ko',
|
|
|
|
'pt-BR': 'pt_br',
|
|
|
|
'ro': 'ro_ro',
|
|
|
|
'ru': 'ru_ru',
|
|
|
|
'tr': 'tr_tr',
|
2020-10-19 19:28:45 +00:00
|
|
|
'pl': 'pl_pl',
|
|
|
|
'uk': 'uk_ua',
|
2020-10-20 19:55:14 +00:00
|
|
|
'hu': 'hu_hu',
|
|
|
|
'ur-PK': 'ur_pk',
|
|
|
|
'hi': 'hi_in'
|
2020-10-15 18:37:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def generate_dart():
|
|
|
|
out = {}
|
|
|
|
with zipfile.ZipFile('translations.zip') as zip:
|
|
|
|
for file in zip.namelist():
|
|
|
|
if 'freezer.json' in file:
|
|
|
|
data = zip.open(file).read()
|
|
|
|
lang = file.split('/')[0]
|
|
|
|
out[lang_crowdin[lang]] = json.loads(data)
|
|
|
|
|
2020-10-19 19:28:45 +00:00
|
|
|
with open('../lib/languages/crowdin.dart', 'w') as f:
|
2020-10-15 18:37:36 +00:00
|
|
|
data = json.dumps(out, ensure_ascii=False).replace('$', '\\$')
|
|
|
|
out = f'const crowdin = {data};'
|
|
|
|
f.write(out)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
generate_dart()
|