v149 · JavaScript · demo

Variant Builder

Build a BCP 47 locale step by step. Add variant subtags using the new { variants: […] } constructor option and see the canonical tag update in real time.

Common: rozaj, biske, 1901, valencia, posix, nedis, alalc97

Canonical BCP 47 tag
Constructor call
.variants result
// Chrome 149+: pass variants in the options bag
const locale = new Intl.Locale('sl', {
  variants: ['rozaj', 'biske'],
});

console.log(locale.toString());  // 'sl-rozaj-biske'
console.log(locale.variants);    // ['rozaj', 'biske']
console.log(locale.language);    // 'sl'

see also

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗