feat(portal-shell): collapse accessibility routes into one i18n-marked route #94

Merged
julien merged 1 commits from feat/portal-shell/i18n-accessibility-route-fusion into main 2026-05-11 20:18:30 +02:00
Owner

Summary

Continue ADR-0019: replace the /accessibility + /accessibilite twin routes with a single canonical route whose content is i18n-marked in the template. The per-locale build (en/fr) already inlines the right copy — the route-data + copy() service indirection is no longer carrying its weight.

What changes

  • AccessibilityStatement loses its ActivatedRoute injection, the Lang discriminator, and the COPY lookup table. The component is now a plain shell over the template.
  • accessibility.html carries the title + intro + status panel as i18n="@@page.accessibility.*" markers. Six new trans-units in messages.fr.xlf provide the French copy — verbatim from the old COPY.fr block, so the page reads the same in FR as before.
  • app.routes.ts declares the single canonical route at path: 'accessibility' and keeps /accessibilite alive as a redirectTo: 'accessibility'. Drops data: { lang: ... } — no longer consumed.
  • footer.html collapses the dual link into one i18n-marked link (@@footer.accessibilityLink). EN bundle reads "Accessibility statement"; FR bundle reads "Déclaration d'accessibilité".

Decision worth flagging

The path stays in English across both locales for now: /en/accessibility and /fr/accessibility. Translating route segments (/fr/declaration-d-accessibilite) needs either a custom URL serializer or per-locale route trees — not worth the complexity at this scale. The page title and the link label already differ per locale via i18n, which is what's actually visible to users.

The historical /accessibilite path keeps working via the route-level redirect. Drops out of the codebase once analytics confirm no traffic reaches it.

Test plan

  • pnpm exec nx run-many -t lint test build --projects=portal-shell — green. 35 / 35 specs (was 36; the obsolete lang-fallback test is removed).
  • Production build emits both locales. FR bundle contains Statut, Déclaration, the FR intro / panel bodies. No leftover English on swept strings.
  • extract-i18n clean (49 unique units now: +5 for page.accessibility.* + footer.accessibilityLink, −0; the old route-data lang markers were not i18n).
  • Manual: serve-static then /en/accessibility and /fr/accessibility render their respective content; /fr/accessibilite 301-redirects to /fr/accessibility.
  • Manual: footer shows one link, locale-aware ("Accessibility statement" / "Déclaration d'accessibilité").
  • Manual: browser tab title flips between bundles ("Accessibility statement · APF Portal" / "Déclaration d'accessibilité · Portail APF").

What this PR explicitly does NOT do

  • Translate the URL path segment (next ADR-only refinement if needed).
  • Add the locale switcher in the footer — that's the next PR on the i18n track.
  • Wire a CI gate on missing translations.
## Summary Continue ADR-0019: replace the `/accessibility` + `/accessibilite` twin routes with a single canonical route whose content is i18n-marked in the template. The per-locale build (en/fr) already inlines the right copy — the route-data + `copy()` service indirection is no longer carrying its weight. ## What changes - **`AccessibilityStatement`** loses its `ActivatedRoute` injection, the `Lang` discriminator, and the `COPY` lookup table. The component is now a plain shell over the template. - **`accessibility.html`** carries the title + intro + status panel as `i18n="@@page.accessibility.*"` markers. Six new trans-units in [`messages.fr.xlf`](apps/portal-shell/src/locale/messages.fr.xlf) provide the French copy — verbatim from the old `COPY.fr` block, so the page reads the same in FR as before. - **`app.routes.ts`** declares the single canonical route at `path: 'accessibility'` and keeps `/accessibilite` alive as a `redirectTo: 'accessibility'`. Drops `data: { lang: ... }` — no longer consumed. - **`footer.html`** collapses the dual link into one i18n-marked link (`@@footer.accessibilityLink`). EN bundle reads "Accessibility statement"; FR bundle reads "Déclaration d'accessibilité". ## Decision worth flagging The path stays in English across both locales for now: `/en/accessibility` and `/fr/accessibility`. Translating route *segments* (`/fr/declaration-d-accessibilite`) needs either a custom URL serializer or per-locale route trees — not worth the complexity at this scale. The page title and the link label already differ per locale via i18n, which is what's actually visible to users. The historical `/accessibilite` path keeps working via the route-level redirect. Drops out of the codebase once analytics confirm no traffic reaches it. ## Test plan - [x] `pnpm exec nx run-many -t lint test build --projects=portal-shell` — green. **35 / 35 specs** (was 36; the obsolete `lang`-fallback test is removed). - [x] Production build emits both locales. FR bundle contains `Statut`, `Déclaration`, the FR intro / panel bodies. No leftover English on swept strings. - [x] `extract-i18n` clean (49 unique units now: +5 for `page.accessibility.*` + `footer.accessibilityLink`, −0; the old route-data `lang` markers were not i18n). - [ ] Manual: serve-static then `/en/accessibility` and `/fr/accessibility` render their respective content; `/fr/accessibilite` 301-redirects to `/fr/accessibility`. - [ ] Manual: footer shows one link, locale-aware ("Accessibility statement" / "Déclaration d'accessibilité"). - [ ] Manual: browser tab title flips between bundles ("Accessibility statement · APF Portal" / "Déclaration d'accessibilité · Portail APF"). ## What this PR explicitly does NOT do - Translate the URL path segment (next ADR-only refinement if needed). - Add the locale switcher in the footer — that's the next PR on the i18n track. - Wire a CI gate on missing translations.
julien added 1 commit 2026-05-11 20:17:24 +02:00
feat(portal-shell): collapse accessibility routes into one i18n-marked route
CI / commits (pull_request) Successful in 3m9s
CI / scan (pull_request) Successful in 3m9s
CI / check (pull_request) Successful in 3m21s
CI / a11y (pull_request) Successful in 2m0s
CI / perf (pull_request) Successful in 6m9s
44f00dced3
Continue ADR-0019: replace the `/accessibility` + `/accessibilite`
twin routes with a single canonical `/accessibility` path whose
content is i18n-marked in templates. The per-locale build (en/fr)
already inlines the right copy — the route data + `copy()` service
indirection is no longer needed.

What changes:

- `AccessibilityStatement` loses its `ActivatedRoute` injection, its
  `Lang` discriminator and the `COPY` lookup table. The component is
  now a plain shell over the template.
- `accessibility.html` carries the title + intro + status panel
  strings as `i18n="@@page.accessibility.*"` markers; six new
  trans-units in `messages.fr.xlf` provide the French copy
  (verbatim from the old `COPY.fr` block, kept identical so the page
  reads the same in FR).
- `app.routes.ts` declares the single canonical route and keeps
  `/accessibilite` as a `redirectTo: 'accessibility'` for backward
  compatibility with existing bookmarks. Drops the `data.lang`
  payload — no longer consumed.
- `footer.html` collapses the dual link (`Accessibility` /
  `Accessibilité`) into one i18n-marked link
  (`@@footer.accessibilityLink`). EN bundle reads "Accessibility
  statement"; FR bundle reads "Déclaration d'accessibilité".

The path stays in English across both locales for now
(`/{en,fr}/accessibility`). Translating route segments
(`/fr/declaration-d-accessibilite`) is a future refinement that needs
either a custom URL serializer or per-locale route trees — not worth
the complexity at this scale.

Specs:

- `accessibility.spec.ts` loses the `lang`-based tests and asserts
  on the rendered EN source content + the amber-panel structure
  (specs run in the source locale).
- `footer.spec.ts` asserts on the single accessibility link and the
  absence of the historical `/accessibilite` href.

Test plan / verification:

- 35/35 specs pass (was 36; one obsolete `lang` fallback test
  removed).
- Production build emits both locales; FR chunk contains "Statut",
  "Déclaration", FR intro/panel bodies, and no leftover English from
  the swept strings.
julien merged commit 8f84cc6389 into main 2026-05-11 20:18:30 +02:00
julien deleted branch feat/portal-shell/i18n-accessibility-route-fusion 2026-05-11 20:18:32 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: julien/apf_portal#94