Localization — language, formatters, pluralisation

@anshinus/i18n

Switch language and every number, date and currency below reformats through Intl. These are the things applications most often hand-roll, and most often get wrong.

Language — 13 supported

From SUPPORTED_LANGUAGES. Selecting one calls setLanguage(); everything below re-renders through Intl in that locale. dir is carried per language, so an RTL locale flips the document rather than needing a separate build.

Active: en — English (English), dir ltr

Formatters — never hand-roll these

Each row is useFormatters() output for the selected language. Change the language above and watch the separators, currency position and date order all move.

formatNumber(1234567.891)1,234,567.89
formatCurrency(1234.5)$1,234.50
formatTime(…14:30Z)02:30 PM
formatDate(2026-09-29)09/29/2026
formatDateTime(…14:30Z)09/29/2026, 02:30 PM
formatRelativeTime(…)2 weeks ago

Pluralisation

pluralize() uses Intl.PluralRules. English has two forms and many languages have more — appending “s” is wrong in most of the list above, which is why this exists at all.

1 document

Translation lookup

t(key) returns the key unchanged when no catalogue entry exists. That is deliberate and visible: a missing string shows as dataTable.noResults rather than as empty space, so it gets noticed and fixed instead of shipping blank.

dataTable.noResultsdataTable.noResults
no entry
dataTable.error.titledataTable.error.title
no entry
common.savecommon.save
no entry
a.missing.keya.missing.key
no entry
Brand