Files
homepage.veen.world/tests/integration/test_ui_translation_coverage.py
Kevin Veen-Birkenbach c6667f3b05 feat(i18n): ship interface translations for every offered language
The language switcher offers all 184 ISO 639-1 languages, but only 29
had a UI catalogue, so the other 154 rendered Close, Imprint, Language
and the rest of the interface strings in English. Nothing noticed:
the existing unit test only checks the catalogues that are present.

A new integration test requires every language except the source to
ship a catalogue with a non-empty entry for each of the 11 interface
strings, and lists missing catalogues apart from incomplete ones. The
154 missing catalogues are added, written through
i18n_sync.write_catalog so they share the existing format; make i18n-ui
never overwrites them, so a later correction survives.

The translations were written without a native reviewer. Most widely
used languages are solid; these are best-effort and likely wrong:
ae, cr, ii, kr, na, nv, oj, sg, aa, hz, ho, mh, za, vo. Uncertain:
ab, ak, av, ay, bi, bm, bo, ce, ch, cu, dv, dz, ee, ff, fj, gn, gv, ie,
ik, iu, kg, ki, kj, kl, ks, kv, kw, lg, li, ln, lu, ng, nr, os, pi, qu,
rn, sa, se, ss, to, tw, ty, ve, wa, wo.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-10 18:05:33 +02:00

38 lines
1.1 KiB
Python

import unittest
from app.utils import i18n
class TestUiTranslationCoverage(unittest.TestCase):
def test_every_language_translates_every_interface_string(self):
without_catalog = []
with_gaps = {}
for code in i18n.LANGUAGES:
if code == i18n.SOURCE_LANGUAGE:
continue
path = i18n.UI_DIR / f"{code}.yaml"
if not path.exists():
without_catalog.append(code)
continue
entries = i18n.read_catalog(path)
gaps = [
source
for source in i18n.UI_STRINGS
if not entries.get(source, "").strip()
]
if gaps:
with_gaps[code] = gaps
if without_catalog or with_gaps:
self.fail(
f"{len(without_catalog) + len(with_gaps)} of "
f"{len(i18n.LANGUAGES) - 1} languages lack interface translations.\n"
f"No catalogue ({len(without_catalog)}): {' '.join(without_catalog)}\n"
f"Missing entries: {with_gaps}"
)
if __name__ == "__main__":
unittest.main()