principle-i18n
Installation
SKILL.md
Internationalization & Localization Principles
i18n bugs are latent — they survive review unnoticed and only surface when the product expands to a new locale.
Locale-Aware Formatting
Use platform APIs that accept a locale tag; never hand-roll date or number rendering.
- Use
Intl.DateTimeFormat(locale, options)andIntl.NumberFormat(locale, options)— notDate.toString(),toLocaleDateString()without a locale argument, or manual template strings. - Pass BCP 47 locale tags (
en-US,fr-FR,ar-EG); rely on CLDR data in the runtime rather than custom format maps. - Never hard-code
MM/DD/YYYY— format order, separator, and calendar system (Gregorian vs. Hijri vs. Buddhist Era) vary by locale. - Currency: let
Intl.NumberFormat(locale, { style: 'currency', currency: 'USD' })place the symbol and decide sign position — never concatenate"$" + amount. - For backend rendering, thread the
Accept-Languageheader or a persisted locale preference down to the formatting layer.
Time Zones: Persist UTC, Render Local
Timestamps recorded in local time become ambiguous at DST boundaries and when users cross time zones.