← Back to Docs
Recipe

Localization Patterns

Shipping Meridian in 14 languages without losing your mind.

Key-based lookups

Every user-facing string lives in a flat JSON dictionary keyed bynamespace.key. The loader picks the right file at boot based onAccept-Language.

Fallback chain

fr-CA → fr → en. If a key is missing in the regional bundle, walk up to the base language, then to English. Never show raw keys to the user.

Plural rules

Use ICU MessageFormat for plurals and gender. One string covers all CLDR plural categories. No concatenation, noif count === 1in templates.

Date and number formatting

Intl.DateTimeFormatandIntl.NumberFormatwith the resolved locale. Never hardcodeMM/DD/YYYY.

RTL support

Setdir="rtl"on the root element for Arabic, Hebrew, and Persian. Mirror layout with logical CSS properties —margin-inline-startinstead ofmargin-left.

Extraction pipeline

A CI job scans fort('...')calls, diffs against the English master, and opens a PR with new keys. Translators never touch code.

Pro tip: Keep strings whole. "You have 3 items" is one ICU string, not three fragments glued together. Token order varies across languages.