This proposal exposes Locale information, such as week data (first day in a week, weekend start day, weekend end day, minimun day in the first week), hour cycle used in the locale, measurement system used in the locale. See the README for more context.
The abstract operation CreateArrayFromListOrRestricted accepts the arguments list and restricted , and performs the following steps:
The following algorithm refers to UTS 35's Unicode Language and Locale Identifiers grammar.
unicode_locale_id
production.The following algorithm refers to UTS 35's Unicode Language and Locale Identifiers grammar.
unicode_locale_id
production.The following algorithm refers to UTS 35's Unicode Language and Locale Identifiers grammar.
unicode_locale_id
production.The following algorithm refers to UTS 35's Unicode Language and Locale Identifiers grammar.
unicode_locale_id
production.The following algorithm refers to UTS 35's Unicode Language and Locale Identifiers grammar.
unicode_locale_id
production.unicode_region_subtag
production of the unicode_language_id
.The abstract operation CharacterDirectionOfLocale accepts the argument loc , and performs the following steps:
unicode_locale_id
production.The abstract operation WeekdayToString accepts the argument fw , and performs the following steps:
Weekday | String | Value |
---|---|---|
The abstract operation StringToWeekdayValue accepts the argument fw , and performs the following steps:
The abstract operation WeekInfoOfLocale accepts the argument loc , and performs the following steps:
unicode_locale_id
production.Field Name | Value | Meaning |
---|---|---|
[[FirstDay]] | The weekday value indicating which day of the week is considered the 'first' day, for calendar purposes. | |
[[Weekend]] | A |
The list of weekday values indicating which days of the week are considered as part of the 'weekend', for calendar purposes. Notice that the number of days in the weekend are different in each locale and may not be contiguous. |
[[MinimalDays]] | The minimal days required in the first week of a month or year, for calendar purposes. |
The Locale
The following algorithm refers to UTS 35's Unicode Language and Locale Identifiers grammar.
unicode_language_subtag
production, throw a unicode_script_subtag
production, throw a unicode_region_subtag
production, throw a unicode_locale_id
production.unicode_language_id
production.unicode_language_subtag
production replaced by the string language.unicode_script_subtag
production, thenunicode_language_subtag
production of languageId, unicode_script_subtag
production replaced by the string script.unicode_region_subtag
production, thenunicode_language_subtag
production of languageId, the substring corresponding to "-"
and the unicode_script_subtag
production if present, "-"
, region, and the rest of languageId.unicode_region_subtag
production replaced by the string region.unicode_language_id
production replaced by the string languageId.The following algorithm refers to UTS 35's Unicode Language and Locale Identifiers grammar.
unicode_locale_id
production.
The following algorithm refers to UTS 35's Unicode Language and Locale Identifiers grammar.
When the
type
sequence (from UTS 35 Unicode Locale Identifier, section 3.2), throw a type
sequence (from UTS 35 Unicode Locale Identifier, section 3.2), throw a type
sequence (from UTS 35 Unicode Locale Identifier, section 3.2), throw a type
sequence (from UTS 35 Unicode Locale Identifier, section 3.2), throw a
The Intl.Locale
The value of
This property has the attributes { [[Writable]]:
The value of the [[RelevantExtensionKeys]] internal slot is «
The Intl.Locale prototype object is itself an ordinary object. %Locale.prototype% is not an Intl.Locale instance and does not have an [[InitializedLocale]] internal slot or any of the other internal slots of Intl.Locale instance objects.
The initial value of
The initial value of the @@toStringTag property is the string value
This property has the attributes { [[Writable]]:
Intl.Locale.prototype.baseName
is an
unicode_language_id
production.Intl.Locale.prototype.calendar
is an
This property only exists if
Intl.Locale.prototype.caseFirst
is an
Intl.Locale.prototype.collation
is an
Intl.Locale.prototype.firstDayOfWeek
is an
Intl.Locale.prototype.hourCycle
is an
This property only exists if
Intl.Locale.prototype.numeric
is an
Intl.Locale.prototype.numberingSystem
is an
Intl.Locale.prototype.language
is an
unicode_locale_id
production.unicode_language_subtag
production of the unicode_language_id
.Intl.Locale.prototype.script
is an
unicode_locale_id
production.unicode_language_id
production of locale does not contain the ["-" unicode_script_subtag]
sequence, return unicode_script_subtag
production of the unicode_language_id
.Intl.Locale.prototype.region
is an
unicode_locale_id
production.unicode_language_id
production of locale does not contain the ["-" unicode_region_subtag]
sequence, return unicode_region_subtag
production of the unicode_language_id
.When the getCalendars
method is called, the following steps are taken:
When the getCollations
method is called, the following steps are taken:
When the getHourCycles
method is called, the following steps are taken:
When the getNumberingSystems
method is called, the following steps are taken:
When the getTimeZones
method is called, the following steps are taken:
The following algorithm refers to UTS 35's Unicode Language and Locale Identifiers grammar.
unicode_language_id
production of locale does not contain the ["-" unicode_region_subtag]
sequence, return When the getTextInfo
method is called, the following steps are taken:
The following algorithm refers to Locale data specified in UTS 35's Layouts Elements.
When the getWeekInfo
method is called, the following steps are taken:
The following algorithm refers to Locale data specified in UTS 35's Week Elements.
Intl.Locale instances are ordinary objects that inherit properties from
Intl.Locale instances have an [[InitializedLocale]] internal slot.
Intl.Locale instances also have several internal slots that are computed by the
The following aspects of the ECMAScript 2022 Internationalization API Specification are implementation dependent:
© 2024 Google, Ecma International
All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT https://ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.