Intl

Internationalization: Intl

The global Intl object, specified by ECMA-402 (first edition 2012), formats and compares text, numbers and dates by the rules of a locale, using the Unicode CLDR data bundled with the engine. Every constructor takes (locales, options). A locale is a BCP 47 tag such as de-CH, with optional extensions after -u- such as -nu-hanidec (numbering system) or -ca-japanese (calendar); an array lists fallbacks. Shortcuts such as toLocaleString() search the locale data on every call, so reuse one Intl object for repeated formatting.

Canonical tags, locale negotiation and a toLocaleString() shortcutJavaScriptLive
console.log(Intl.getCanonicalLocales(['EN-us', 'zh-hans-cn', 'en-US']));
const nf = new Intl.NumberFormat(['ban', 'id']);          // 'ban' unsupported: falls back to 'id'
console.log(nf.resolvedOptions().locale, nf.format(1234.5), (1234.5).toLocaleString('de-CH'));
console.log(Intl.NumberFormat.supportedLocalesOf(['ban', 'id', 'de-CH']));

Output in this section comes from Node.js 25.8 2,131 (ICU 78.2, CLDR 48); runtimes with other CLDR versions may differ in spacing or abbreviations, so never hard-code formatted strings in cross-browser tests.

Subsections