Widely availableSupported across all major browsers. Safe to use in production.

Overview

The Intl.Locale API parses Unicode locale identifiers, with language, region, and script codes, such as zh-Hans-CN or en-GB.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
74
79
75
14
74
14
Built-in object

The Intl.Locale() constructor creates Intl.Locale objects.

74
79
75
14
74
14

The baseName accessor property of Intl.Locale instances returns a substring of this locale's string representation, containing core information about this locale, including the language, script, region, and variants, if available.

74
79
75
14
74
14

The calendar accessor property of Intl.Locale instances returns the calendar type for this locale.

74
79
75
14
74
14

The caseFirst accessor property of Intl.Locale instances returns whether case is taken into account for this locale's collation rules.

74
79
75
14
74
14

The collation accessor property of Intl.Locale instances returns the collation type for this locale, which is used to order strings according to the locale's rules.

74
79
75
14
74
14

The hourCycle accessor property of Intl.Locale instances returns the hour cycle type for this locale.

74
79
75
14
74
14

The language accessor property of Intl.Locale instances returns the language associated with this locale.

74
79
75
14
74
14

The maximize() method of Intl.Locale instances gets the most likely values for the language, script, and region of this locale based on existing values.

74
79
75
14
74
14

The minimize() method of Intl.Locale instances attempts to remove information about this locale that would be added by calling Intl/Locale/maximize.

74
79
75
14
74
14

The numberingSystem accessor property of Intl.Locale instances returns the numeral system for this locale.

74
79
75
14
74
14

The numeric accessor property of Intl.Locale instances returns whether this locale has special collation handling for numeric characters.

74
79
75
14
74
14

The region accessor property of Intl.Locale instances returns the region of the world (usually a country) associated with this locale.

74
79
75
14
74
14

The script accessor property of Intl.Locale instances returns the script used for writing the particular language used in this locale.

74
79
75
14
74
14

The toString() method of Intl.Locale instances returns this Locale's full locale identifier string.

74
79
75
14
74
14
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)

Syntax

JAVASCRIPT
const locale = new Intl.Locale('ja-JP-u-ca-japanese');
locale.language;  // 'ja'
locale.region;    // 'JP'
locale.calendar;  // 'japanese'

Live demo

Intl.Locale

roke-lidentifier object and.

PreviewFullscreen

option withroke-l

Calendar, numberingSystem equal. option also specifiedpossible.

PreviewFullscreen

roke-l. Parse

roke-lstring structureizationeachpartial to akses.

PreviewFullscreen

Use cases

  • Using Intl.Locale

    The Intl.Locale API parses Unicode locale identifiers, with language, region, and script codes, such as zh-Hans-CN or en-GB.

Cautions

  • No specific concerns. Stable across all major browsers.

Accessibility

  • When updating the DOM dynamically, announce important changes to assistive technology with aria-live regions.

Powered by web-features