Aller au contenu
login
arrow_backRetour aux issues
ChelseaKR/habitable #208

Add a pseudo-locale / text-expansion check for the app's i18n bundles

ecoDébutant enhancement good first issue

descriptionDescription

## Summary `docs/good-first-issues.md` already names this as wanted work: "A pseudo-locale or text-expansion check to catch layouts that break under longer translations." `scripts/check_i18n_parity.py` enforces key/plural/placeholder parity between `app/i18n/en.json` and `es.json`, but nothing checks that the UI actually *survives* a translation meaningfully longer than English — Spanish already runs longer than English in a number of keys today, and a future language could run longer still. ## Suggested shape - A pseudo-locale generator (script or test fixture) that takes `en.json` and produces a synthetic locale where every string is expanded by a fixed ratio (30–50% longer is a common default for this technique) while preserving placeholders (`{name}`) and plural structure exactly. Reuse `scripts/check_i18n_parity.py`'s flattening/plural-parsing helpers rather than re-implementing them — see its `_flatten`/plural-message handling. - Wire the generated pseudo-locale into the existing Playwright-driven checks (`tests/test_app_axe.py`, or the 320px-reflow assertions in `tests/test_app_keyboard.py`) so it's checked at the same narrow viewport those already use, not just at desktop width. - Scope this to the app's `app/i18n/` bundles; `packet.html`/`packet.pdf` rendering is a separate, already-tested surface (`tests/test_htmlpacket.py`) and out of scope here. ## Done when - Running the generator against current `en.json` produces a pseudo-locale that still parses correctly under `check_i18n_parity.py`'s placeholder/plural rules (prove the fixture itself is well-formed). - At least one layout assertion fails loudly against a deliberately-broken CSS rule (prove the check can catch something) before you fix it back — the same "prove the gate is real" discipline the existing axe/keyboard tests already follow — then the check should pass clean against the real stylesheet. - `make verify` is green.
codeOuvre sur GitHub