Skip to content
Toolkit

ADR-0084 — A registry label is copy, resolved at the render boundary

Status: Accepted · Date: 2026-08-29 · Track: 005-i18n, phase 02

Context

apps/web/src/lib/navigation.ts and lib/catalogue.ts are registries, not components: one declares every sidebar, command-palette, breadcrumb, mobile-tab and account-menu entry (ADR-0015), the other every product the launcher offers. Between them they hold 52 strings a user reads.

Both are .ts. The extraction counter reads .tsx and Studio's .jsx only (ADR-0080), so all 52 were invisible to it — and the four surfaces that draw them counted as cleared while their visible words were still English. The navigation slice that "cleared" the sidebar in fact cleared everything except its labels. That is the shape of defect this track exists to close, one file type over.

Three constraints decide the mechanism:

  1. Rule 3 of check-i18n-coverage.mjs checks literal keys only, because a computed key is a key no gate can verify. t(nav.${destination.id}) — the obvious way to translate a registry — is exactly what it refuses.
  2. A module-scope constant is evaluated once, at import. A label resolved where it is declared freezes the catalogue that was loaded before the page rendered — the same finding that moved a dozen option arrays into their components on earlier slices.
  3. Two gates read these literals. check-navigation-parity.mjs rules A and B parse label: out of this source to refuse a retired word and to hold a nav entry to its registry's name; replacing the English with a key would blind both.

Decision

The declared English stays. Resolution happens at the render boundary, through literal keys, in a written-out map.

  • Each registry exports navLabels(t) and its neighbours — one literal t() per line, keyed by the entry's id. There is no interpolated key and there cannot be one.
  • The selectors (sidebarSections, paletteSections, mobileTabs, labelForPath, accountMenu, catalogueSections, searchCatalogue) take the translator as a required parameter and resolve as they select. A registry is not a component, so it takes t rather than calling a hook — the shape ADR-0080 gives Studio, one layer in. Required, not optional: an optional translator is a surface that renders English by forgetting an argument, and nothing would catch it.
  • The declared string is the fallback, so an unkeyed entry renders its English word rather than a key.
  • A label the product registries own carries no key. The eight fromRegistry() destinations and every catalogue product take their word from @cardsite/link-model / @cardsite/product-model (ADR-0030); a key here would be a second place to rename a product, which is the drift those derivations exist to prevent. They stay the registry's word until the registry itself is served translated.

Consequences

  • The unit tests hold the correspondence in both directions, against the real bundled en.json rather than a stub: every non-derived entry has a key whose English equals the declared word; every derived entry has none; no key names an entry that does not exist. A new destination cannot ship silently untranslated, and a catalogue whose English drifted renames the sidebar for every user with no served language — so it fails here instead.
  • The extraction counter does not move for this slice (135 → 135). That is recorded as a movement row of its own in evidence/i18n-baseline.md: 52 strings were extracted and the ratchet cannot see any of them, which is worth writing down precisely because a reader would otherwise reconstruct "nothing happened" from an unchanged number.
  • The translated call-site floor rises 2,799 → 2,851. A registry that takes t registers with the gate through its type import from ../i18n, so its keys are rule-3 checked like any component's.
  • Widening the counter to .ts is not decided here. It would be a scope change under ADR-0080's rule — re-baselined in the same commit with its reason — and it would sweep in far more than these two files.

Source: docs/decisions/0084-a-registry-label-is-copy-resolved-at-the-render-boundary.md

Library