MENU
Intl
Introduced in ECMAScript 6, the Intl object provides ways to deal with different locales.
Intl.getCanonicalLocales() can be used to obtain unique, standardized locale names.
RESETRUNFULL
RESETRUNFULL
<!DOCTYPE html><html><body><script>
console.log(Intl.getCanonicalLocales('EN-US')); // ["en-US"]console.log(Intl.getCanonicalLocales(['EN-US', 'Fr', 'FR',
'zh-hans-cn'])); // ["en-US", "fr", "zh-Hans-CN"]// Intl.getCanonicalLocales('EN_US'); // RangeError
</script></body><html>
For a list of the languages, see the IANA language subtag registry at: http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry(Many trivialities are associated with Intl. This section may be skipped or skimmed through if the reader does not intend to learn the details of dealing with different locales. The details are included here for completeness.)