Skip to content
Toolkit

ADR-0088 — A language is offered only where the catalogue carries it

Status: Accepted · Date: 2026-08-29 · Track: 005-i18n, phase 04 · Follows ADR-0010, ADR-0081, ADR-0082, ADR-0087.

The finding

ADR-0010 unmounted a language switcher that changed nothing, because every string in the tree was hardcoded English. ADR-0082 archived a second control that wrote a language name into a column no reader read. Both were the same defect: a control that answers success to a choice nothing acts on.

Phase 04 owes the control's return, and the condition on it has been fixed since ADR-0010: a language control ships only once selecting a language changes what a user reads. The extraction has met it — 2,895 t() call sites over 2,778 keys, and the residue audited to 82 sample values, proper nouns and pixel dimensions. So the flag is released.

But meeting that condition in the repository is not the same as meeting it on a screen. A deployment decides what is translated, not this repository. The catalogue is served from languages.strings, an operator types into it, and a stock database has no languages row at all. Ship an unconditional select and the first thing a fresh install draws is a language control with one option in it — ADR-0010's lie, one size smaller and harder to see, because now the code behind it genuinely works.

The decision

The offered list is the served catalogue plus the bundled English under it, and the control draws nothing when that list has one entry.

  1. availableLanguages is what the control offers, not what the wire said. It starts as bundled English alone and is replaced — not merged — when initI18n() resolves: the served languages, with English prepended if the server has no en row of its own. A served en row wins, because its name is the operator's.
  2. Fewer than two entries, no control. Not disabled, not a select with one option: absent. An operator adds a second language and the control appears, with no deploy — the same shape 003 gave block types and 004 gave plan capabilities.
  3. The list is read reactively, through useSyncExternalStore. ADR-0087 moved the catalogue's arrival to after mount, so a component reading the module variable at render time would draw the one-language list forever and never hear the second arrive.
  4. The choice lands in both stores ADR-0082 named, in its order: the localStorage cache synchronously, then users.language through PATCH /api/v1/account. A failed profile write surfaces through the global error toaster; the screen has already changed language, and the choice does not outlive this browser.
  5. The profile is the authority, applied once in App — the pre-boot cache is read at import time, before any profile exists, so a conflict resolves to the profile. Only to a code the offered list carries: a stale row naming a language the operator has since deactivated must not strand a user on a catalogue nobody serves.
  6. <html lang> and <html dir> follow the choice. languages.direction has been served all along and read by nothing; it is the difference between reading an RTL catalogue and staring at it.

Why not the alternatives

Offer every language the server lists, translated or not. This is what the pre-ADR-0010 switcher did. A language row with strings: {} resolves every key to the English fallback (ADR-0081), so choosing it changes nothing at all — the exact behaviour rule 1 exists to refuse. Rule 2 of this decision is the version of that check the gate cannot make, because emptiness is a runtime fact.

Gate on translation coverage — offer a language only past some percentage. Rejected: it needs a threshold nobody can defend, it would hide a language an operator deliberately added for one page, and a partly-translated catalogue still changes what a user reads. Presence in the catalogue is the operator's statement of intent, and the operator is the one who knows.

Put it back on the Settings page, where ADR-0082 found the last one. The account menu already holds the theme picker, which is the same kind of thing — a preference this browser applies immediately, not a form to be saved. Settings is where the archived control taught users to look for a write that did nothing.

Consequences

  • check:i18n rule 1 no longer runs: controlAllowed is true, permanently. What replaces it as the guard is LanguageSwitcher.test.tsx, which asserts the condition rather than the absence — that a served second language changes a rendered heading, and that one language alone draws no control.
  • A fresh install sees no language control, and that is correct, not a regression. Adding a language in the admin portal is what reveals it.
  • users.language has a reader for the first time in this port's history (ADR-0082's census found none), which is what makes writing it honest.
  • The residue phase 02 left is unaffected: 82 strings stay counted, and the product calls named in 005's SESSION are still product calls.

Source: docs/decisions/0088-a-language-is-offered-only-where-the-catalogue-carries-it.md

Library