`Intl.getCanonicalLocales()` 方法返回一个数组，数组包含规范的区域语言代码，重复的元素将会被去除，每一个元素都会被验证为格式有效的区域语言代码。

The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

## Syntax

    Intl.getCanonicalLocales(locales)

### 参数

`locales`
  想要规范化的字符串数组。

### Return value

一个包含规范区域语言代码的数组。

## 例子

    Intl.getCanonicalLocales('EN-US'); // ["en-US"]
    Intl.getCanonicalLocales(['EN-US', 'Fr']); // ["en-US", "fr"]

    Intl.getCanonicalLocales('EN_US');
    // RangeError:'EN_US' is not a structurally valid language tag

## 规范

Specification | Status | Comment
--- | --- | ---
ECMAScript Internationalization API 4.0 (ECMA-402) Intl.getCanonicalLocales | Draft | Initial definition

## 浏览器兼容

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

Update compatibility data on GitHub

| Desktop | Mobile | Server
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | Safari on iOS | Samsung Internet | Node.js
`getCanonicalLocales` | Chrome Full support 54 | Edge Full support 16 | Firefox Full support 48 | IE No support No | Opera No support No | Safari Full support 11 | WebView Android No support No | Chrome Android No support No | Edge Mobile No support No | Firefox Android Full support 56 | Opera Android No support No | Safari iOS Full support 11 | Samsung Internet Android No support No | nodejs No support No

### Legend

Full support
  Full support
No support
  No support

## 参见

- `Intl.NumberFormat.supportedLocalesOf()`
- `Intl.DateTimeFormat.supportedLocalesOf()`
- `Intl.Collator.supportedLocalesOf()`