Skip to content

Commit

Permalink
Normative: Stage4 PR for proposal-intl-enumeration (#716)
Browse files Browse the repository at this point in the history
* Normative: Stage4 PR for proposal-intl-enumeration

Plan to suggest moving to Stage 4 in Nov 2022
https://github.com/tc39/proposal-intl-enumeration

It is already implemented in Chrome m99, Safari 15.4 and Firefox 93.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/supportedValuesOf#browser_compatibility

* sync w/ intl-enumeration pull/43

tc39/proposal-intl-enumeration#43

* Update spec/locales-currencies-tz.html

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update spec/locales-currencies-tz.html

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update spec/locales-currencies-tz.html

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update spec/locales-currencies-tz.html

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update spec/locales-currencies-tz.html

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update spec/locales-currencies-tz.html

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update spec/locales-currencies-tz.html

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

* Update spec/locales-currencies-tz.html

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>

---------

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
  • Loading branch information
FrankYFTang and gibson042 authored Apr 3, 2023
1 parent 19d2ade commit 81856b3
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 2 deletions.
27 changes: 27 additions & 0 deletions spec/intl.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,32 @@ <h1>Intl.getCanonicalLocales ( _locales_ )</h1>
1. Return CreateArrayFromList(_ll_).
</emu-alg>
</emu-clause>

<emu-clause id="sec-intl.supportedvaluesof">
<h1>Intl.supportedValuesOf ( _key_ )</h1>

<p>
When the `supportedValuesOf` method is called with argument _key_ , the following steps are taken:
</p>

<emu-alg>
1. Let _key_ be ? ToString(_key_).
1. If _key_ is *"calendar"*, then
1. Let _list_ be AvailableCanonicalCalendars( ).
1. Else if _key_ is *"collation"*, then
1. Let _list_ be AvailableCanonicalCollations( ).
1. Else if _key_ is *"currency"*, then
1. Let _list_ be AvailableCanonicalCurrencies( ).
1. Else if _key_ is *"numberingSystem"*, then
1. Let _list_ be AvailableCanonicalNumberingSystems( ).
1. Else if _key_ is *"timeZone"*, then
1. Let _list_ be AvailableCanonicalTimeZones( ).
1. Else if _key_ is *"unit"*, then
1. Let _list_ be AvailableCanonicalUnits( ).
1. Else,
1. Throw a *RangeError* exception.
1. Return CreateArrayFromList( _list_ ).
</emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
95 changes: 93 additions & 2 deletions spec/locales-currencies-tz.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<emu-clause id="locales-currencies-tz">
<h1>Identification of Locales, Currencies, Time Zones, and Measurement Units</h1>
<h1>Identification of Locales, Currencies, Time Zones, Measurement Units, Numbering Systems, Collations, and Calendars</h1>

<p>
This clause describes the String values used in the ECMAScript 2023 Internationalization API Specification to identify locales, currencies, time zones, and measurement units.
This clause describes the String values used in this specification to identify locales, currencies, time zones, measurement units, numbering systems, collations, and calendars.
</p>

<emu-clause id="sec-case-sensitivity-and-case-mapping">
Expand Down Expand Up @@ -159,6 +159,15 @@ <h1>IsWellFormedCurrencyCode ( _currency_ )</h1>
</emu-clause>
</emu-clause>

<emu-clause id="sec-availablecanonicalcurrencies" type="implementation-defined abstract operation">
<h1>AvailableCanonicalCurrencies (
): a List of Strings</h1>
<dl class="header">
<dt>description</dt>
<dd>The returned List is ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using *undefined* as _comparefn_, and contains unique, well-formed, and upper case canonicalized 3-letter ISO 4217 currency codes, identifying the currencies for which the implementation provides the functionality of Intl.DisplayNames and Intl.NumberFormat objects.</dd>
</dl>
</emu-clause>

<emu-clause id="sec-time-zone-names">
<h1>Time Zone Names</h1>

Expand Down Expand Up @@ -218,6 +227,29 @@ <h1>DefaultTimeZone ( ): a String</h1>
This definition supersedes the definition provided in es2023, <emu-xref href="#sec-defaulttimezone"></emu-xref>.
</p>
</emu-clause>

<emu-clause id="sec-availablecanonicaltimezones" type="implementation-defined abstract operation">
<h1>
AvailableCanonicalTimeZones (
): a List of Strings
</h1>
<dl class="header">
<dt>description</dt>
<dd>The returned List is a sorted List of supported Zone and Link names in the IANA Time Zone Database.</dd>
</dl>

<emu-alg>
1. Let _names_ be a List of all Zone and Link names in the IANA Time Zone Database that are supported by the implementation.
1. Let _result_ be a new empty List.
1. For each element _name_ of _names_, do
1. Assert: ! IsValidTimeZoneName( _name_ ) is *true*.
1. Let _canonical_ be ! CanonicalizeTimeZoneName( _name_ ).
1. If _result_ does not contain _canonical_, then
1. Append _canonical_ to the end of _result_.
1. [declared="comparefn"] Sort _result_ in order as if an Array of the same values had been sorted using %Array.prototype.sort% using *undefined* as _comparefn_.
1. Return _result_.
</emu-alg>
</emu-clause>
</emu-clause>

<emu-clause id="sec-measurement-unit-identifiers">
Expand Down Expand Up @@ -322,5 +354,64 @@ <h1>IsSanctionedSingleUnitIdentifier ( _unitIdentifier_ )</h1>
</table>
</emu-table>
</emu-clause>
<emu-clause id="sec-availablecanonicalunits" type="abstract operation">
<h1>AvailableCanonicalUnits (
): a List of Strings</h1>
<dl class="header">
<dt>description</dt>
<dd>The returned List is ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using *undefined* as _comparefn_, and consists of the unique values of simple unit identifiers listed in every row of <emu-xref href="#table-sanctioned-single-unit-identifiers"></emu-xref>, except the header row.</dd>
</dl>
</emu-clause>
</emu-clause>

<emu-clause id="sec-numberingsystem-identifiers">
<h1>Numbering System Identifiers</h1>

<p>
This specification identifies numbering systems using a <dfn variants="numbering system identifiers">numbering system identifier</dfn> corresponding with the name referenced by <a href="https://unicode.org/reports/tr35/tr35-numbers.html#Numbering_Systems">Unicode Technical Standard #35 Part 3 Numbers, Section 1 Numbering Systems</a>. Their canonical form is a string containing only Unicode Basic Latin lowercase letters (U+0061 LATIN SMALL LETTER A through U+007A LATIN SMALL LETTER Z).
</p>

<emu-clause id="sec-availablecanonicalnumberingsystems" type="implementation-defined abstract operation">
<h1>AvailableCanonicalNumberingSystems (
): a List of Strings</h1>
<dl class="header">
<dt>description</dt>
<dd>The returned List is ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using *undefined* as _comparefn_, and contains unique canonical numbering systems identifiers identifying the numbering systems for which the implementation provides the functionality of Intl.DateTimeFormat, Intl.NumberFormat, and Intl.RelativeTimeFormat objects. The list must include the Numbering System value of every row of <emu-xref href="#table-numbering-system-digits"></emu-xref>, except the header row.</dd>
</dl>
</emu-clause>
</emu-clause>

<emu-clause id="sec-collation-types">
<h1>Collation Types</h1>

<p>
This specification identifies collations using a <dfn variants="collation types">collation type</dfn> as defined by <a href="https://unicode.org/reports/tr35/tr35-collation.html#Collation_Types">Unicode Technical Standard #35 Part 5 Collation, Section 3.1 Collation Types</a>. Their canonical form is a string containing only Unicode Basic Latin lowercase letters (U+0061 LATIN SMALL LETTER A through U+007A LATIN SMALL LETTER Z) with zero or more medial hyphens (U+002D HYPHEN-MINUS).
</p>

<emu-clause id="sec-availablecanonicalcollations" type="implementation-defined abstract operation">
<h1>AvailableCanonicalCollations (
): a List of Strings</h1>
<dl class="header">
<dt>description</dt>
<dd>The returned List is ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using *undefined* as _comparefn_, and contains unique canonical collation types identifying the collations for which the implementation provides the functionality of Intl.Collator objects.</dd>
</dl>
</emu-clause>
</emu-clause>

<emu-clause id="sec-calendar-types">
<h1>Calendar Types</h1>

<p>
This specification identifies calendars using a <dfn variants="calendar types">calendar type</dfn> as defined by <a href="https://unicode.org/reports/tr35/tr35-dates.html#Calendar_Elements">Unicode Technical Standard #35 Part 4 Dates, Section 2 Calendar Elements</a>. Their canonical form is a string containing only Unicode Basic Latin lowercase letters (U+0061 LATIN SMALL LETTER A through U+007A LATIN SMALL LETTER Z) with zero or more medial hyphens (U+002D HYPHEN-MINUS).
</p>

<emu-clause id="sec-availablecanonicalcalendars" type="implementation-defined abstract operation">
<h1>AvailableCanonicalCalendars (
): a List of Strings</h1>
<dl class="header">
<dt>description</dt>
<dd>The returned List is ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using *undefined* as _comparefn_, and contains unique canonical calendar types identifying the calendars for which the implementation provides the functionality of Intl.DateTimeFormat objects. The list must include *"iso8601"*.</dd>
</dl>
</emu-clause>
</emu-clause>
</emu-clause>

0 comments on commit 81856b3

Please sign in to comment.