Wielojęzyczność

i18n/intl-format

Dates, times, numbers and prices are formatted with Intl for the user's locale, never assembled from parts.

umiarkowanastatycznefe-i18n

Dlaczego

Date order, separators, month names, decimal marks, grouping and the place of the currency sign differ by locale: 11/12/2026 is November in the US and December in Poland, and "1,234.50 zł" is wrong in Polish ("1234,50 zł"). Hand-built strings are right for one locale at most.

Poprawka

Create formatters once per locale and reuse them: new Intl.DateTimeFormat(locale, { dateStyle: 'medium' }), new Intl.NumberFormat(locale, { style: 'currency', currency }), Intl.RelativeTimeFormat for "3 days ago", Intl.ListFormat for "A, B and C". Keep machine formats (ISO 8601 in datetime, APIs) separate from display.

Przykłady

// bad
d.getDate() + '.' + (d.getMonth() + 1) + '.' + d.getFullYear()
total.toFixed(2) + ' zł'
// good
new Intl.DateTimeFormat(locale, { dateStyle: 'medium' }).format(d)
new Intl.NumberFormat(locale, { style: 'currency', currency: 'PLN' }).format(total)

Źródła

Fakty

Identyfikator
i18n/intl-format
Waga
umiarkowana
Sprawdzanie
statyczne sprawdzane w kodzie źródłowym przez audit
Dotyczy plików
jsx vue svelte astro html
Uczy jej skill
fe-i18n Internationalisation
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

npx github:dawidolko/frontend-skills explain i18n/intl-format