@nhic/rwds-i18n
v1.0.0
Published
RWDS internationalisation: en, rw and fr catalogs, a typed translator, formatters, working days and Rwandan identifiers.
Readme
@nhic/rwds-i18n
Built-in RWDS strings in English, Kinyarwanda and French, plus a typed ICU translator and a pseudo-locale. It also has formatters for RWF, dates and working days, the Rwanda public-holiday calendar, and parsing and formatting for Rwandan phone numbers, national IDs and TINs.
English is the default and the source language. rw and fr always have exactly the same keys.
import { createTranslator, resolveLocale } from '@nhic/rwds-i18n';
import { rw } from '@nhic/rwds-i18n/catalogs/rw';
const t = createTranslator(rw, { overrides: { 'workingDays.overdue': '…' } });- Typed keys and arguments. A wrong key or a missing argument is a type error.
- Overrides never break a page. A broken override falls back to the built-in message and logs one console warning.
- Pseudo-locale.
pseudoCatalog(en)returns accented text padded by 40%. Use it in tests to catch clipped and hard-coded strings.
Catalogs live in src/messages/. After editing them, run pnpm generate. CI checks that every locale has every key, that the ICU syntax and argument names match, that every key has a description, and that every key is used.
