Intl.Locale

The Intl.Locale constructor is a standard built-in property of the Intl object that represents a Unicode locale identifier.

시도해보기

Syntax

    new Intl.Locale(tag [, options])

Parameters

tag

The Unicode locale identifier string.

options

An object that contains configuration for the Locale. Keys are Unicode locale tags, values are valid Unicode tag values.

Description

The Intl.Locale object was created to allow for easier manipulation of Unicode locales. Unicode represents locales with a string, called a locale identifier. The locale identifier consists of a language identifier and extension tags. Language identifiers are the core of the locale, consisting of language, script, and region subtags. Additional information about the locale is stored in the optional extension tags. Extension tags hold information about locale aspects such as calendar type, clock type, and numbering system type.

Traditionally, the Intl API used strings to represent locales, just as Unicode does. This is a simple and lightweight solution that works well. Adding a Locale class, however, adds ease of parsing and manipulating the language, script, and region, as well as extension tags.

The Intl.Locale object has the following properties and methods:

Properties

Intl.Locale.prototype (en-US)

The prototype object for the Locale constructor.

Specifications

Specification
ECMAScript Internationalization API Specification
# locale-objects

Browser compatibility

BCD tables only load in the browser

See also