--- title: Intl.getCanonicalLocales() slug: Web/JavaScript/Reference/Global_Objects/Intl/getCanonicalLocales tags: - Internationalization - Intl - JavaScript - Method translation_of: Web/JavaScript/Reference/Global_Objects/Intl/getCanonicalLocales ---
Intl.getCanonicalLocales() メソッドは、正規のロケール名を含む配列を返します。重複は省略され、要素は構造的に有効な言語タグとして検証されます。
Intl.getCanonicalLocales(locales)
locales正規のロケール名を含む配列です。
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
| 仕様書 |
|---|
| {{SpecName('ES Int Draft', '#sec-intl.getcanonicallocales', 'Intl.getCanonicalLocales')}} |
{{Compat("javascript.builtins.Intl.getCanonicalLocales")}}