--- 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 ---
Die Intl.getCanonicalLocales()
Methode gibt ein Array mit den anerkannten Gebietsnamen zurück. Duplikate werden verhindert und Elemente werden auf valide Sprach-Tag-Struktur geprüft.
Intl.getCanonicalLocales(locales)
locales
Ein Array mit den anerkannten Gebietsnamen.
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
Spezifikation | Status | Kommentar |
---|---|---|
{{SpecName('ES Int Draft', '#sec-intl.getcanonicallocales', 'Intl.getCanonicalLocales')}} | {{Spec2('ES Int Draft')}} | Initiale Definition |
{{Compat("javascript.builtins.Intl.getCanonicalLocales")}}