mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-25 10:42:58 -03:00
Fix check-weblate.py to accurately describe the levels of translations
This commit is contained in:
parent
f471346f04
commit
6328626683
2 changed files with 39 additions and 21 deletions
|
@ -48,9 +48,13 @@ GET https://hosted.weblate.org/api/translations/onionshare/translations/hr/
|
||||||
GET https://hosted.weblate.org/api/translations/onionshare/translations/eo/
|
GET https://hosted.weblate.org/api/translations/onionshare/translations/eo/
|
||||||
GET https://hosted.weblate.org/api/translations/onionshare/translations/ja/
|
GET https://hosted.weblate.org/api/translations/onionshare/translations/ja/
|
||||||
<...snip...>
|
<...snip...>
|
||||||
GET https://hosted.weblate.org/api/translations/onionshare/doc-tor/he/ | error 404
|
GET https://hosted.weblate.org/api/translations/onionshare/doc-tor/wo/ | error 404
|
||||||
GET https://hosted.weblate.org/api/translations/onionshare/doc-tor/en/
|
GET https://hosted.weblate.org/api/translations/onionshare/doc-tor/ar/
|
||||||
GET https://hosted.weblate.org/api/translations/onionshare/doc-tor/cs/ | error 404
|
GET https://hosted.weblate.org/api/translations/onionshare/doc-tor/it/
|
||||||
|
|
||||||
|
App translations >= 100%
|
||||||
|
=======================
|
||||||
|
English (en), 100.0%
|
||||||
|
|
||||||
App translations >= 90%
|
App translations >= 90%
|
||||||
=======================
|
=======================
|
||||||
|
@ -62,7 +66,6 @@ Chinese (Traditional) (zh_Hant), 95.0%
|
||||||
Croatian (hr), 95.0%
|
Croatian (hr), 95.0%
|
||||||
Danish (da), 94.5%
|
Danish (da), 94.5%
|
||||||
Dutch (nl), 92.6%
|
Dutch (nl), 92.6%
|
||||||
English (en), 100.0%
|
|
||||||
French (fr), 98.0%
|
French (fr), 98.0%
|
||||||
Galician (gl), 97.5%
|
Galician (gl), 97.5%
|
||||||
German (de), 95.0%
|
German (de), 95.0%
|
||||||
|
@ -84,16 +87,24 @@ Swedish (sv), 94.5%
|
||||||
Turkish (tr), 98.0%
|
Turkish (tr), 98.0%
|
||||||
Ukrainian (uk), 98.0%
|
Ukrainian (uk), 98.0%
|
||||||
|
|
||||||
App translations >= 75%
|
App translations >= 80%
|
||||||
=======================
|
=======================
|
||||||
Finnish (fi), 88.1%
|
Finnish (fi), 88.1%
|
||||||
|
|
||||||
Docs translations >= 90%
|
Docs translations >= 100%
|
||||||
========================
|
========================
|
||||||
English (en), 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%
|
English (en), 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%
|
||||||
Turkish (tr), 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%
|
Turkish (tr), 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%
|
||||||
Ukrainian (uk), 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%
|
Ukrainian (uk), 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%
|
||||||
|
|
||||||
Docs translations >= 75%
|
Docs translations >= 90%
|
||||||
========================
|
========================
|
||||||
|
|
||||||
|
|
||||||
|
Docs translations >= 80%
|
||||||
|
========================
|
||||||
|
German (de), 90.6%, 100.0%, 82.1%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%
|
||||||
|
Greek (el), 90.6%, 100.0%, 82.1%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%
|
||||||
|
Russian (ru), 90.6%, 100.0%, 82.1%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%
|
||||||
|
Spanish (es), 90.6%, 100.0%, 82.1%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%, 100.0%
|
||||||
```
|
```
|
||||||
|
|
|
@ -15,7 +15,9 @@ async def api(path):
|
||||||
url = f"https://hosted.weblate.org{path}"
|
url = f"https://hosted.weblate.org{path}"
|
||||||
|
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
r = await client.get(url, headers={"Authorization": f"Token {api_token}"})
|
r = await client.get(
|
||||||
|
url, headers={"Authorization": f"Token {api_token}"}, timeout=30.0
|
||||||
|
)
|
||||||
|
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
print(f"GET {url}")
|
print(f"GET {url}")
|
||||||
|
@ -41,12 +43,12 @@ async def get_docs_translation(component, lang_code):
|
||||||
docs_translations[component][lang_code] = obj["translated_percent"]
|
docs_translations[component][lang_code] = obj["translated_percent"]
|
||||||
|
|
||||||
|
|
||||||
async def app_percent_output(percent_min, percent_max=100):
|
async def app_percent_output(percent_min, percent_max=101):
|
||||||
out = []
|
out = []
|
||||||
for lang_code in languages:
|
for lang_code in languages:
|
||||||
if (
|
if (
|
||||||
app_translations[lang_code] >= percent_min
|
app_translations[lang_code] >= percent_min
|
||||||
and app_translations[lang_code] <= percent_max
|
and app_translations[lang_code] < percent_max
|
||||||
):
|
):
|
||||||
out.append(
|
out.append(
|
||||||
f"{languages[lang_code]} ({lang_code}), {app_translations[lang_code]}%"
|
f"{languages[lang_code]} ({lang_code}), {app_translations[lang_code]}%"
|
||||||
|
@ -61,7 +63,7 @@ async def app_percent_output(percent_min, percent_max=100):
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
|
|
||||||
async def docs_percent_output(percent_min, percent_max=100):
|
async def docs_percent_output(percent_min, exclude=[]):
|
||||||
out = []
|
out = []
|
||||||
for lang_code in languages:
|
for lang_code in languages:
|
||||||
include_language = True
|
include_language = True
|
||||||
|
@ -74,10 +76,7 @@ async def docs_percent_output(percent_min, percent_max=100):
|
||||||
|
|
||||||
percentages.append(docs_translations[component][lang_code])
|
percentages.append(docs_translations[component][lang_code])
|
||||||
|
|
||||||
if (
|
if docs_translations[component][lang_code] < percent_min:
|
||||||
docs_translations[component][lang_code] < percent_min
|
|
||||||
or docs_translations[component][lang_code] > percent_max
|
|
||||||
):
|
|
||||||
include_language = False
|
include_language = False
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -86,13 +85,19 @@ async def docs_percent_output(percent_min, percent_max=100):
|
||||||
percentages = ", ".join(percentages)
|
percentages = ", ".join(percentages)
|
||||||
out.append(f"{languages[lang_code]} ({lang_code}), {percentages}")
|
out.append(f"{languages[lang_code]} ({lang_code}), {percentages}")
|
||||||
|
|
||||||
out.sort()
|
excluded = []
|
||||||
|
for s in out:
|
||||||
|
if s not in exclude:
|
||||||
|
excluded.append(s)
|
||||||
|
|
||||||
|
excluded.sort()
|
||||||
|
|
||||||
print(f"Docs translations >= {percent_min}%")
|
print(f"Docs translations >= {percent_min}%")
|
||||||
print("========================")
|
print("========================")
|
||||||
print("\n".join(out))
|
print("\n".join(excluded))
|
||||||
|
|
||||||
print("")
|
print("")
|
||||||
|
return excluded
|
||||||
|
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
|
@ -135,11 +140,13 @@ async def main():
|
||||||
|
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
await app_percent_output(90)
|
await app_percent_output(100)
|
||||||
await app_percent_output(75, 90)
|
await app_percent_output(90, 100)
|
||||||
|
await app_percent_output(80, 90)
|
||||||
|
|
||||||
await docs_percent_output(90)
|
out100 = await docs_percent_output(100)
|
||||||
await docs_percent_output(75, 90)
|
out90 = await docs_percent_output(90, out100)
|
||||||
|
await docs_percent_output(80, out100 + out90)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Add table
Reference in a new issue