Decisions
0005 · Own i18n layer
A small typed translation layer replaces i18next, react-i18next and next-i18next.
Status: Accepted · 2026-11
Context
Three locales, a few hundred strings, one namespace, plurals in two places. Version 1 carried three i18n packages for that, and keys were untyped strings — several referenced keys didn't exist (confirm.backToIntro.*) and rendered as raw keys.
Decision
- Dictionaries are TypeScript objects. Portuguese defines the
Dictionarytype; other languages must satisfy it. t(key, vars)with type-checked dotted keys and{name}interpolation;tp(key, count)picks_one/_otherviaIntl.PluralRules.- Server Components call
createTranslator(locale); client components useuseI18n()from a provider that only receives the locale. - Formatting uses
Intldirectly throughlib/money.tsandfeatures/bill/format.ts.
Consequences
- Missing translations and typos in keys are compile errors.
- No runtime dependency; about 150 lines to read and maintain.
- No ICU message syntax. If the app ever needs gender/select rules or many more locales, revisit this record.