# Internationalisation (i18n) — news-platform Short sketch for **BIT-739** and follow-on work. ## Current model (minimal, non-breaking) 1. **Per-domain locale** — Each hostname loads `config/domains/.json`. The `locale` field is a BCP 47 tag (e.g. `pt-PT` for andebol.net, `en-US` for localhost / English hubs). 2. **Document language** — `frontend/src/layouts/Base.astro` sets `` so regional variants (e.g. `pt-PT`) are preserved for accessibility and SEO. 3. **Static UI strings** — `frontend/src/lib/ui-i18n.ts` maps the **primary language subtag** (`pt` from `pt-PT`) to a string table. English is the fallback for unknown languages. When a second Portuguese variant is needed (e.g. `pt-BR`), add an explicit branch in `getUiStrings` rather than overloading `pt`. 4. **Runtime formatting** — Dates and relative times use `Intl` via `frontend/src/lib/format.ts`, passing the same `config.locale` as the domain JSON. 5. **Auth chrome** — Login/register labels for `auth_links` use `frontend/src/lib/auth-labels.ts` (Portuguese when `locale` starts with `pt`). 6. **Editorial content** — Headlines, bodies, and categories come from WordPress / the bridge; they are not translated by the frontend. Domain config supplies **section labels** (`categories[].label`) in the target language for each site. ## Preparing for fuller multilang (not implemented yet) Possible directions when the product requires multiple languages **on the same hostname**: - **Path prefix** — e.g. `/en/...`, `/pt/...`, with middleware choosing `locale` and canonical/hreflang rules. - **Subdomains** — e.g. `en.example.com` / `pt.example.com`, each with its own domain JSON or a shared base plus `locale` override. - **Cookie / Accept-Language** — optional overlay once URLs and caching semantics are defined (CDN keys, bridge cache). Until then, **one locale per hostname** keeps SSR caching and domain routing simple. ## Operations alignment Production Astro SSR should reach the bridge on an internal URL. Set **`BRIDGE_INTERNAL_URL`** on the frontend process so JSON `bridge_endpoint` loopback values in repo configs are overridden at runtime — see `frontend/src/lib/domain.ts` and `docs/deployment.md`.