feat(i18n): per-bundle LOCALE_ID + language switching under docker compose
CI / frontend (push) Successful in 3m18s
CI / backend (push) Successful in 2m28s
CI / storybook-a11y (push) Successful in 7m54s
CI / semgrep (push) Successful in 1m25s
CI / e2e (push) Successful in 3m54s
CI / api-client-drift (push) Successful in 2m10s

Fix the hardcoded LOCALE_ID: 'nl' — provide it from $localize.locale (the build-time
locale, 'nl'/'en', undefined→'nl' in dev) and register both nl+en locale data, so the en
bundle formats dates/numbers correctly. Make `docker compose up` serve the LOCALIZED build:
the web service now runs `ng build --localize` then serve-i18n.mjs, which gained a PORT env
+ an /api reverse-proxy (API_PROXY_TARGET → the api container) so both /nl/ and /en/ are
served with the language switcher working end-to-end. Drop the now-unused proxy.conf.docker.json
(serve-i18n proxies /api itself); update ARCHITECTURE. `npm start` stays the nl-only HMR loop.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
eho
2026-07-23 17:51:46 +02:00
co-authored by Claude Opus 4.8
parent 92f825242a
commit 00c5faacb9
5 changed files with 48 additions and 20 deletions
+7 -1
View File
@@ -9,6 +9,7 @@ import type { ActivatedRouteSnapshot } from '@angular/router';
import { provideHttpClient, withInterceptors } from '@angular/common/http';
import { registerLocaleData } from '@angular/common';
import localeNl from '@angular/common/locales/nl';
import localeEn from '@angular/common/locales/en';
import { routes } from './app.routes';
import { scenarioInterceptor } from '@shared/infrastructure/scenario.interceptor';
@@ -19,7 +20,9 @@ import { SessionStore } from '@auth/application/session.store';
import { provideRouteFocus } from '@shared/layout/route-focus';
import { provideUnloadFlush } from '@shared/application/pending-saves';
// Both locales' data so DatePipe/number pipes work for whichever bundle is active.
registerLocaleData(localeNl);
registerLocaleData(localeEn);
export const appConfig: ApplicationConfig = {
providers: [
@@ -50,7 +53,10 @@ export const appConfig: ApplicationConfig = {
provideHttpClient(withInterceptors(isDevMode() ? [scenarioInterceptor, roleInterceptor] : [])),
provideApiClient(),
{ provide: SESSION_PORT, useExisting: SessionStore },
{ provide: LOCALE_ID, useValue: 'nl' },
// Per-bundle locale: the localize build sets `$localize.locale` ('nl'/'en'); the
// non-localized dev/source build leaves it undefined → fall back to 'nl'. (Was hardcoded
// 'nl', which mis-formatted dates/numbers in the en bundle.)
{ provide: LOCALE_ID, useFactory: () => $localize.locale ?? 'nl' },
provideRouteFocus(),
provideUnloadFlush(),
],