feat(portal-shell): ci gate — fail prod build on missing translations #98
Reference in New Issue
Block a user
Delete Branch "feat/portal-shell/i18n-ci-gate-missing-translations"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Set
"i18nMissingTranslation": "error"on the production build configuration inapps/portal-shell/project.json. The Angular CLI checks every<source>extracted fromi18nmarkers and$localizecalls against the loaded translation file (messages.fr.xlf); with the flag onerror, the build now fails when a target is missing instead of silently falling back to the source text in the FR bundle.Closes the loop on ADR-0019 §"Confirmation" — the final piece of the i18n track that does not depend on the BFF route + cookie work (deferred to the auth-flow chantier).
Gate mechanics
pnpm ci:checkrunsnx affected -t ... build, which uses the production configuration by default. A PR that adds ani18nmarker without updatingmessages.fr.xlffails its build job → merge blocked.production), so no other CI plumbing is needed.Verification
Locally, temporarily inserting an unmarked-in-fr string:
then running
pnpm exec nx build portal-shell --configuration=productionproduces:…with a non-zero exit code. The patch was reverted before commit.
Test plan
pnpm exec nx run-many -t lint test build --projects=portal-shell— green (40 / 40 specs, build still passes on the current state).i18nmarker without updatingmessages.fr.xlfshould fail at thebuildstep with the explicit error.What this PR explicitly does NOT do
i18n="@@..."to a new template line). That would need a custom ESLint rule against the Angular template AST — a separate, smaller scope mentioned in ADR-0019 as a future refinement.nx extract-i18nproduces diffs against the committedmessages.xlf, but we don't commitmessages.xlftoday).Set `i18nMissingTranslation: "error"` on the production build configuration. The Angular CLI checks every `<source>` extracted from `i18n` markers and `$localize` calls against the loaded translation file (`messages.fr.xlf`), and now fails the build if a target is missing instead of silently falling back to the source text in the FR bundle. Gates automatically through CI: `pnpm ci:check` runs `nx affected -t ... build`, which uses the production configuration by default. A PR that adds an `i18n` marker without updating `messages.fr.xlf` fails its build job and blocks the merge. Verified locally by temporarily inserting an unmarked-in-fr string, running the prod build, observing the explicit error message: ERROR: No translation found for "sanity.test.missingTranslation" ("A string with no FR translation"). Closes the loop on ADR-0019 §"Confirmation" — the final piece of the i18n track before the BFF route + cookie work (deferred to the auth-flow chantier).