v149 · javascript · internationalization · covered on mdn
Intl.Locale.prototype.variants
Chrome 149 adds the variants accessor to Intl.Locale — returning an array of BCP 47 language variant subtags for a locale — and accepts a variants option in the Intl.Locale constructor. Part of the TC39 ECMA-402 language ID update (merged into the spec via pull #960).
this API is documented on MDN
MDN: Intl.Locale.prototype.variants
MDN documents the accessor, constructor option, return type, examples, and browser compatibility. Firefox 141 and Safari 26 also ship this. gendn doesn't duplicate that reference here.
quick reference
| Member | Kind | Returns |
|---|---|---|
Intl.Locale.prototype.variants | accessor (getter) | Array<string> — BCP 47 variant subtags, e.g. ["1901", "rozaj"] |
new Intl.Locale(tag, { variants }) | constructor option | Sets variant subtags for the new locale object |
quick example
// Read variants from a locale tag
const loc = new Intl.Locale('de-DE-1901');
console.log(loc.variants); // ['1901']
// Construct with variants option
const sl = new Intl.Locale('sl', { variants: ['rozaj', '1994'] });
console.log(sl.toString()); // 'sl-rozaj-1994'
console.log(sl.variants); // ['rozaj', '1994']
Source: tc39/test262 PR #4474
shipped in
| Chrome 149+ | Enabled by default |
|---|---|
| Firefox 141+ | Shipped |
| Safari 26+ | Shipped |
| Spec | ECMA-402 Living Standard |
| ChromeStatus | 4709921706868736 — Intl.Locale.prototype.variants |