feat(portal-shell): wire @angular/localize plumbing per ADR-0019 #91
Reference in New Issue
Block a user
Delete Branch "feat/portal-shell/i18n-plumbing"
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
First implementation step of ADR-0019. Wire the
@angular/localizeplumbing intoportal-shellso the next sweep PR can start marking UI strings without any infrastructure work.What changes
@angular/localizeto a direct dependency (it was already a transitive via the Angular metapackage; promoting it makes theinitpolyfill explicitly resolvable from the project).i18nblock inapps/portal-shell/project.json:sourceLocale: { code: "en", baseHref: "/en/" }— matches the project English-only rule.locales.fr: { translation: "...messages.fr.xlf", baseHref: "/fr/" }— single target locale for now.initpolyfill to the build target ("polyfills": ["@angular/localize/init"]).extract-i18nNx target that wraps Angular's@angular/build:extract-i18nexecutor and drops the source XLF next to the translation files.--localizeon the production build —nx build portal-shell --configuration=productionnow emits two folders side by side:dist/apps/portal-shell/browser/en/and.../fr/. Each carries its own<html lang>and<base href>per the ADR.messages.fr.xlf(XLIFF 1.2 skeleton with sourceLanguage="en" / targetLanguage="fr" and an inline editor convention note). The sweep PR drops<trans-unit>entries directly into the body block.Verification
Until the sweep PR marks strings, both bundles ship the same English source text — that's expected and matches what the ADR calls out ("the FR bundle falls back to source text for every untranslated key").
What this PR explicitly does NOT do
i18nattribute /$localizecall lands in the next PR. Pure infra commit here.__Host-portal_localecookie + smart/redirect. Lands once switching shows a meaningful difference./accessibility+/accessibiliteinto a single localised route. Depends on marked text + localized route paths — sweep PR territory.Test plan
pnpm exec nx run-many -t lint test build --projects=portal-shell— green (36 / 36 specs unchanged).pnpm exec nx build portal-shell --configuration=production— produces both locale folders with correct<html lang>and<base href>.pnpm exec nx run portal-shell:extract-i18n— runs cleanly, reports(Messages: 0)as expected.main; +1.5 kB for the@angular/localizeruntime polyfill). Both stay well under the 300 KB budget.pnpm exec nx serve portal-shellruns unchanged (source localeen, no--localizein dev for now).