From e834d93cd31e45bb084fcd657132ff65a91b093b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Wed, 27 Aug 2025 10:52:26 +0200 Subject: [PATCH] Tweak `check-completion-ratio.py` to get stats on all langs. (cherry picked from commit 15183b120c8b7484bf0fd67ee941cf49b25cd5ef) --- check-completion-ratio.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/check-completion-ratio.py b/check-completion-ratio.py index 2a31930680..508925d5af 100755 --- a/check-completion-ratio.py +++ b/check-completion-ratio.py @@ -3,13 +3,19 @@ import polib -def check(lang): +def get_percent_translated(lang): + """ + Get overall translation completion percentage. + """ pofile = polib.pofile("./weblate/{}.po".format(lang)) + return pofile.percent_translated() - if pofile.percent_translated() > 50: - return - print("==== {} - {}% translated ====".format(lang, pofile.percent_translated())) +def get_stats(lang): + """ + Print completion stats per folder. + """ + pofile = polib.pofile("./weblate/{}.po".format(lang)) statistic = {} # section -> [complete, incomplete] for entry in pofile: @@ -27,10 +33,10 @@ def check(lang): for k, v in sorted(statistic.items()): ratio = v[0] / (v[0] + v[1]) - if ratio > 0.5: - print("{:5.1f}\t{}".format(100 * ratio, k or "")) + print("{:5.1f}\t{}".format(100 * ratio, k or "")) with open("build_langs.txt") as f: for lang in f.read().splitlines(): - check(lang) + completion = get_percent_translated(lang) + print("==== {}:\t{}% translated ====".format(lang, completion))