INNER CODE UNIT · Python
coverage
blokadaorg/blokada · .github/scripts/translation_coverage.py:59
def coverage(en, translated):
"""(covered, total) keys: present, non-empty, and differing from English."""
total = len(en)
if translated is None or total == 0:
return 0, total
covered = 0
for key, src in en.items():
val = translated.get(key)
if isinstance(val, str) and val.strip() and val != src:
covered += 1
return covered, total
def pct(covered, total):
return 100.0 * covered / total if total else 0.0
def run():