Files
apf_portal/apps
Julien Gautier 0808c0be68
CI / scan (pull_request) Successful in 2m24s
CI / commits (pull_request) Successful in 2m35s
CI / check (pull_request) Successful in 3m6s
CI / a11y (pull_request) Successful in 1m24s
CI / perf (pull_request) Successful in 5m24s
feat(portal-shell): locale switcher in the footer
Add a CDK-menu locale switcher (FR / EN) to the footer's right
cluster, next to the accessibility link. Trigger reads the active
locale from `<html lang>` (set per locale by the build) and shows
the native name plus a globe + chevron. Selecting another locale
rewrites the URL prefix (`/en/...` ↔ `/fr/...`) and triggers a hard
refresh so the right bundle boots — per ADR-0019.

Architecture mirrors the existing theme switcher:

- `@angular/cdk/menu` for the trigger + roving-focus menu + escape /
  click-outside dismissal.
- `ViewEncapsulation.None` because the menu opens in an overlay
  portal outside the component host; BEM-style class names keep the
  global emissions contained.
- The trigger's `aria-label` is `$localize`-marked with a named
  placeholder so screen readers announce the current language.

Locale display names ("Français", "English") are deliberately NOT
i18n-marked. Universal switcher convention: each language is always
shown in its own language, both in the trigger label and the menu
items — translating them would defeat the purpose. The
`<button>` for each menu entry carries `[attr.lang]="locale.code"`
so screen readers pronounce the name correctly.

v1 is SPA-only:

- No backend cookie, no `/api/preferences/locale` BFF route, no
  smart `/` redirect — those land when the BFF is in place. Until
  then the locale prefix in the URL is the source of truth; the
  next visit naturally lands on the same locale's bundle.
- The switcher works against the production build (`/en/`, `/fr/`).
  Under `nx serve` the dev server has no locale prefix, so clicking
  the trigger lands on a non-existent path. Expected — dev mode
  serves the source locale by design (ADR-0019).

Touch target: the trigger keeps a 28px visible height to fit the
40px footer, but extends to 44px via vertical padding — meets the
ADR-0016 AAA touch-target minimum without inflating the footer.

Add Globe to the icon registry (single new entry).
2026-05-11 20:46:30 +02:00
..