1
0
Fork 0
mirror of https://gitlab.com/fdroid/fdroidclient.git synced 2024-12-02 18:30:56 +01:00

tools/trim-incomplete-translations-for-release.py: update locales_config.xml

This commit is contained in:
Hans-Christoph Steiner 2023-11-09 15:16:02 +01:00
parent 13c799e735
commit aedceed7c4
2 changed files with 24 additions and 33 deletions

View file

@ -4,16 +4,11 @@
<locale android:name="af" />
<locale android:name="ar" />
<locale android:name="ast" />
<locale android:name="az" />
<locale android:name="be" />
<locale android:name="ber" />
<locale android:name="bg" />
<locale android:name="bn" />
<locale android:name="bn-BD" />
<locale android:name="bo" />
<locale android:name="br" />
<locale android:name="ca" />
<locale android:name="ckb" />
<locale android:name="cs" />
<locale android:name="cy" />
<locale android:name="da" />
@ -23,64 +18,42 @@
<locale android:name="eo" />
<locale android:name="es" />
<locale android:name="es-AR" />
<locale android:name="es-MX" />
<locale android:name="et" />
<locale android:name="eu" />
<locale android:name="fa" />
<locale android:name="fi" />
<locale android:name="fil" />
<locale android:name="fr" />
<locale android:name="fy" />
<locale android:name="gd" />
<locale android:name="gl" />
<locale android:name="he" />
<locale android:name="hi" />
<locale android:name="hr" />
<locale android:name="hu" />
<locale android:name="hy" />
<locale android:name="id" />
<locale android:name="in" />
<locale android:name="is" />
<locale android:name="it" />
<locale android:name="iw" />
<locale android:name="ja" />
<locale android:name="ka" />
<locale android:name="kab" />
<locale android:name="kk" />
<locale android:name="kmr" />
<locale android:name="kn" />
<locale android:name="ko" />
<locale android:name="lb" />
<locale android:name="lt" />
<locale android:name="lv" />
<locale android:name="mk" />
<locale android:name="ml" />
<locale android:name="mn" />
<locale android:name="mr" />
<locale android:name="my" />
<locale android:name="nah" />
<locale android:name="nb" />
<locale android:name="ne" />
<locale android:name="nl" />
<locale android:name="nl-BE" />
<locale android:name="nn" />
<locale android:name="oc" />
<locale android:name="or" />
<locale android:name="pa" />
<locale android:name="pa-PK" />
<locale android:name="pl" />
<locale android:name="ps" />
<locale android:name="pt" />
<locale android:name="pt-BR" />
<locale android:name="pt-PT" />
<locale android:name="ro" />
<locale android:name="ru" />
<locale android:name="sc" />
<locale android:name="si" />
<locale android:name="sk" />
<locale android:name="sl" />
<locale android:name="sn" />
<locale android:name="so" />
<locale android:name="sq" />
<locale android:name="sr" />
<locale android:name="sv" />
@ -89,11 +62,7 @@
<locale android:name="te" />
<locale android:name="th" />
<locale android:name="tr" />
<locale android:name="tt" />
<locale android:name="tzm" />
<locale android:name="ug" />
<locale android:name="uk" />
<locale android:name="ur" />
<locale android:name="vi" />
<locale android:name="yue" />
<locale android:name="zh-CN" />

View file

@ -23,11 +23,23 @@ url = 'https://hosted.weblate.org/exports/stats/f-droid/f-droid/?format=csv'
r = requests.get(url)
stats = csv.reader(r.iter_lines(decode_unicode=True), delimiter=',')
next(stats) # skip CSV header
locales_config = set()
for row in stats:
if len(row) > 4:
if float(row[4]) > 70.0:
continue
locale = row[1]
if float(row[4]) > 70.0:
if locale == 'nb_NO':
locale = 'nb'
elif locale == 'yue_Hant':
locale = 'yue'
elif locale == 'zh_Hans':
locale = 'zh-CN'
elif locale == 'zh_Hant':
locale = 'zh-TW'
elif locale == 'zh_Hant_HK':
locale = 'zh-HK'
locales_config.add(locale.replace('_', '-'))
continue
if '_' in locale:
codes = locale.split('_')
if codes[1] == 'Hans':
@ -47,6 +59,16 @@ for row in stats:
msg += ' '
msg += percent + ' ' + row[1] + ' ' + row[0] + '\n'
with open('app/src/main/res/xml/locales_config.xml', 'w') as fp:
fp.write("""<?xml version="1.0" encoding="utf-8"?>
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
<locale android:name="en-US" />""")
locales_config.remove('en')
fp.write('\n')
for locale in sorted(locales_config):
fp.write(f' <locale android:name="{locale}" />\n')
fp.write('</locale-config>\n')
found = False
for remote in repo.remotes:
if remote.name == 'weblate':