You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Let _O_ be RequireObjectCoercible(*this* value).
59
+
1. Let _O_ be ? RequireObjectCoercible(*this* value).
60
60
1. Let _S_ be ? ToString(_O_).
61
-
1. Let _requestedLocales_ be ? CanonicalizeLocaleList(_locales_).
62
-
1. If _requestedLocales_ is not an empty List, then
63
-
1. Let _requestedLocale_ be _requestedLocales_[0].
64
-
1. Else,
65
-
1. Let _requestedLocale_ be DefaultLocale().
66
-
1. Let _noExtensionsLocale_ be the String value that is _requestedLocale_ with any Unicode locale extension sequences (<emu-xrefhref="#sec-unicode-locale-extension-sequences"></emu-xref>) removed.
67
-
1. Let _availableLocales_ be a List with language tags that includes the languages for which the Unicode Character Database contains language sensitive case mappings. Implementations may add additional language tags if they support case mapping for additional locales.
68
-
1. Let _locale_ be BestAvailableLocale(_availableLocales_, _noExtensionsLocale_).
69
-
1. If _locale_ is *undefined*, let _locale_ be *"und"*.
70
-
1. Let _cpList_ be a List containing in order the code points of _S_ as defined in es2022, <emu-xrefhref="#sec-ecmascript-language-types-string-type"></emu-xref>, starting at the first element of _S_.
71
-
1. Let _cuList_ be a List where the elements are the result of a lower case transformation of the ordered code points in _cpList_ according to the Unicode Default Case Conversion algorithm or an implementation-defined conversion algorithm. A conforming implementation's lower case transformation algorithm must always yield the same _cpList_ given the same _cuList_ and locale.
72
-
1. Let _L_ be a String whose elements are the UTF-16 Encoding (defined in es2022, <emu-xrefhref="#sec-ecmascript-language-types-string-type"></emu-xref>) of the code points of _cuList_.
Lower case code point mappings may be derived according to a tailored version of the Default Case Conversion Algorithms of the Unicode Standard. Implementations may use locale specific tailoring defined in SpecialCasings.txt and/or CLDR and/or any other custom tailoring.
78
-
</p>
79
-
80
-
<emu-note>
81
-
The case mapping of some code points may produce multiple code points. In this case the result String may not be the same length as the source String. Because both `toLocaleUpperCase` and `toLocaleLowerCase` have context-sensitive behaviour, the functions are not symmetrical. In other words, `s.toLocaleUpperCase().toLocaleLowerCase()` is not necessarily equal to `s.toLocaleLowerCase()`.
82
-
</emu-note>
83
-
84
64
<emu-note>
85
65
The `toLocaleLowerCase` function is intentionally generic; it does not require that its *this* value be a String object. Therefore, it can be transferred to other kinds of objects for use as a method.
<dd>It interprets _S_ as a sequence of UTF-16 encoded code points, as described in <emu-xrefhref="#sec-ecmascript-language-types-string-type"></emu-xref>, and returns the result of implementation- and locale-dependent (ILD) transformation into _targetCase_ as a new String value.</dd>
79
+
</dl>
80
+
<emu-alg>
81
+
1. Let _requestedLocales_ be ? CanonicalizeLocaleList(_locales_).
82
+
1. If _requestedLocales_ is not an empty List, then
83
+
1. Let _requestedLocale_ be _requestedLocales_[0].
84
+
1. Else,
85
+
1. Let _requestedLocale_ be ! DefaultLocale().
86
+
1. Let _noExtensionsLocale_ be the String value that is _requestedLocale_ with any Unicode locale extension sequences (<emu-xrefhref="#sec-unicode-locale-extension-sequences"></emu-xref>) removed.
87
+
1. Let _availableLocales_ be a List with language tags that includes the languages for which the Unicode Character Database contains language sensitive case mappings. Implementations may add additional language tags if they support case mapping for additional locales.
88
+
1. Let _locale_ be ! BestAvailableLocale(_availableLocales_, _noExtensionsLocale_).
89
+
1. If _locale_ is *undefined*, set _locale_ to *"und"*.
90
+
1. Let _codePoints_ be ! StringToCodePoints(_S_).
91
+
1. If _targetCase_ is ~lower~, then
92
+
1. Let _newCodePoints_ be a List whose elements are the result of a lower case transformation of _codePoints_ according to an implementation-derived algorithm using _locale_ or the Unicode Default Case Conversion algorithm.
93
+
1. Else,
94
+
1.Assert:_targetCase_ is ~upper~.
95
+
1. Let _newCodePoints_ be a List whose elements are the result of an upper case transformation of _codePoints_ according to an implementation-derived algorithm using _locale_ or the Unicode Default Case Conversion algorithm.
96
+
1. Return ! CodePointsToString(_newCodePoints_).
97
+
</emu-alg>
98
+
99
+
<p>
100
+
Code point mappings may be derived according to a tailored version of the Default Case Conversion Algorithms of the Unicode Standard. Implementations may use locale-sensitive tailoring defined in the file <ahref="https://unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt"><code>SpecialCasing.txt</code></a> of the Unicode Character Database and/or CLDR and/or any other custom tailoring. Regardless of tailoring, a conforming implementation's case transformation algorithm must always yield the same result given the same input code points, locale, and target case.
101
+
</p>
102
+
103
+
<emu-note>
104
+
The case mapping of some code points may produce multiple code points, and therefore the result may not be the same length as the input. Because both `toLocaleUpperCase` and `toLocaleLowerCase` have context-sensitive behaviour, the functions are not symmetrical. In other words, `s.toLocaleUpperCase().toLocaleLowerCase()` is not necessarily equal to `s.toLocaleLowerCase()` and `s.toLocaleLowerCase().toLocaleUpperCase()` is not necessarily equal to `s.toLocaleUpperCase()`.
This function interprets a String value as a sequence of code points, as described in es2022, <emu-xrefhref="#sec-ecmascript-language-types-string-type"></emu-xref>. This function behaves in exactly the same way as `String.prototype.toLocaleLowerCase`, except that characters are mapped to their _uppercase_ equivalents. A conforming implementation's upper case transformation algorithm must always yield the same result given the same sequence of code points and locale.
117
+
This function interprets a String value as a sequence of code points, as described in es2022, <emu-xrefhref="#sec-ecmascript-language-types-string-type"></emu-xref>. The following steps are taken:
98
118
</p>
99
119
120
+
<emu-alg>
121
+
1. Let _O_ be ? RequireObjectCoercible(*this* value).
The `toLocaleUpperCase` function is intentionally generic; it does not require that its *this* value be a String object. Therefore, it can be transferred to other kinds of objects for use as a method.
1. Let _normalized_ be the result of mapping _currency_ to upper case as described in <emu-xrefhref="#sec-case-sensitivity-and-case-mapping"></emu-xref>.
156
-
1. If the number of elements in_normalized_ is not 3, return *false*.
157
-
1. If _normalized_ contains any character that is not in the range *"A"* to *"Z"* (U+0041 to U+005A), return *false*.
156
+
1. If the length of _normalized_ is not 3, return *false*.
157
+
1. If _normalized_ contains any code unit outside of 0x0041 through 0x005A (corresponding to Unicode characters LATIN CAPITAL LETTER A through LATIN CAPITAL LETTER Z), return *false*.
158
158
1. Return *true*.
159
159
</emu-alg>
160
160
</emu-clause>
@@ -220,7 +220,7 @@ <h1>DefaultTimeZone ( )</h1>
220
220
<h1>Measurement Unit Identifiers</h1>
221
221
222
222
<p>
223
-
The ECMAScript 2022 Internationalization API Specification identifies measurement units using a <em>core unit identifier</em> as defined by <ahref="https://unicode.org/reports/tr35/tr35-general.html#Unit_Elements">Unicode Technical Standard #35, Part 2, Section 6</a>. Their canonical form is a string containing all lowercase letters with zero or more hyphens.
223
+
The ECMAScript 2022 Internationalization API Specification identifies measurement units using a <em>core unit identifier</em> as defined by <ahref="https://unicode.org/reports/tr35/tr35-general.html#Unit_Elements">Unicode Technical Standard #35, Part 2, Section 6</a>. Their canonical form is a string containing only Unicode Basic Latin lower case letters (U+0061 LATIN SMALL LETTER A through U+007A LATIN SMALL LETTER Z) with zero or more medial hyphens (U+002D HYPHEN-MINUS).
1. If the result of IsWellFormedUnitIdentifier(_unit_) is *false*, throw a *RangeError* exception.
177
177
1. Let _unitDisplay_ be ? GetOption(_options_, *"unitDisplay"*, *"string"*, «*"short"*, *"narrow"*, *"long"*», *"short"*).
178
178
1. If _style_ is *"currency"*, then
179
-
1. Let _currency_ be the result of converting_currency_ to upper case as specified in <emu-xrefhref="#sec-case-sensitivity-and-case-mapping"></emu-xref>.
179
+
1. Let _currency_ be the result of mapping_currency_ to upper case as specified in <emu-xrefhref="#sec-case-sensitivity-and-case-mapping"></emu-xref>.
180
180
1. Set _intlObj_.[[Currency]] to _currency_.
181
181
1. Set _intlObj_.[[CurrencyDisplay]] to _currencyDisplay_.
182
182
1. Set _intlObj_.[[CurrencySign]] to _currencySign_.
0 commit comments