Standard built-ins
Intl.getCanonicalLocales()
Canonicalize and deduplicate locale tags while preserving first occurrence order; malformed tags throw RangeError.
Formal Syntax & Structure
javascript syntaxjavascript
Intl.getCanonicalLocales([locales])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| locales | String | Array | Requested locale tag or prioritized locale list. |
Return Value
Array<String>
Canonical locale identifiers.
Working Example
Example Snippetjavascript
console.log(JSON.stringify(Intl.getCanonicalLocales(["EN-us","en-US"])));