v149 · Intl.Locale · BCP 47
Round-trip Tester
Parse a BCP 47 tag → extract the components including variants → reconstruct a new Intl.Locale from those parts → compare the reconstructed tag to the original. A perfect round-trip confirms the variants API is lossless.
Input locale tag
Examples:
de-1901
de-Latn-AT-1901
sl-rozaj-biske
sr-Latn-ekavsk
en-US
zh-Hant-TW
ar-AE
Step-by-step flow
Parse a tag to see the round-trip steps.
Parsed components
—
—Enter a tag and click Parse.
Round-trip verdict
Run a test to see the verdict.
Test log — results appear here.
// Chrome 149: parse a locale tag and extract its variant subtags
const locale = new Intl.Locale('de-Latn-AT-1901');
console.log(locale.variants); // → ['1901']
// Round-trip: reconstruct from parts
const reconstructed = new Intl.Locale(locale.language, {
script: locale.script,
region: locale.region,
variants: locale.variants, // ← new in Chrome 149
});
console.log(reconstructed.toString()); // → 'de-Latn-AT-1901' ✓
console.log(
locale.toString() === reconstructed.toString() // → true
);
see also
- Locale Inspector — see all locale components for any tag
- Variant Builder — construct a locale step by step
- Language Negotiation — best-match locale from a list
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗