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
The actual return values are implementation-defined to permit implementers to encode additional information in the value. The method is required to return *+0*<sub>𝔽</sub> when comparing Strings that are considered canonically equivalent by the Unicode standard.
246
+
The actual return values are implementation-defined to permit implementers to encode additional information in the value. The method is required to return *+0*<sub>𝔽</sub> when comparing Strings that are considered canonically equivalent by the Unicode Standard.
The CanonicalCodeForDisplayNames abstract operation is called with arguments _type_ and _code_. It verifies that the _code_ argument represents a well-formed code according to the _type_ argument and returns the case-regularized form of the _code_. The algorithm refers to <ahref="https://www.unicode.org/reports/tr35/#Identifiers">UTS 35's Unicode Language and Locale Identifiers grammar</a>. The following steps are taken:
251
+
The CanonicalCodeForDisplayNames abstract operation takes arguments _type_(a String) and _code_ (a String). It verifies that the _code_ argument represents a well-formed code according to the _type_ argument and returns the case-regularized form of the _code_. The algorithm refers to <ahref="https://www.unicode.org/reports/tr35/#Identifiers">UTS 35's Unicode Language and Locale Identifiers grammar</a>. The following steps are taken:
252
252
</p>
253
253
<emu-alg>
254
254
1. If _type_ is *"language"*, then
255
255
1. If _code_ does not match the `unicode_language_id` production, throw a *RangeError* exception.
256
-
1. If IsStructurallyValidLanguageTag(_code_) is *false*, throw a *RangeError* exception.
257
-
1. Set _code_ to CanonicalizeUnicodeLocaleId(_code_).
258
-
1. Return _code_.
256
+
1. If ! IsStructurallyValidLanguageTag(_code_) is *false*, throw a *RangeError* exception.
257
+
1. Return ! CanonicalizeUnicodeLocaleId(_code_).
259
258
1. If _type_ is *"region"*, then
260
259
1. If _code_ does not match the `unicode_region_subtag` production, throw a *RangeError* exception.
261
-
1. Let _code_ be the result of mapping _code_ to upper case as described in <emu-xrefhref="#sec-case-sensitivity-and-case-mapping"></emu-xref>.
262
-
1. Return _code_.
260
+
1. Return the ASCII-uppercase of _code_.
263
261
1. If _type_ is *"script"*, then
264
262
1. If _code_ does not match the `unicode_script_subtag` production, throw a *RangeError* exception.
265
-
1. Let _code_ be the result of mapping the first character in _code_ to upper case, and mapping the second, third, and fourth character in _code_ to lower case, as described in <emu-xrefhref="#sec-case-sensitivity-and-case-mapping"></emu-xref>.
266
-
1. Return _code_.
263
+
1.Assert: The length of _code_ is 4, and every code unit of _code_ represents an ASCII letter (0x0041 through 0x005A and 0x0061 through 0x007A, both inclusive).
264
+
1. Let _first_ be the ASCII-uppercase of the substring of _code_ from 0 to 1.
265
+
1. Let _rest_ be the ASCII-lowercase of the substring of _code_ from 1.
266
+
1. Return the string-concatenation of _first_ and _rest_.
267
267
1. If _type_ is *"calendar"*, then
268
268
1. If _code_ does not match the Unicode Locale Identifier `type` nonterminal, throw a *RangeError* exception.
269
-
1.Let_code_be the result of mapping _code_ to lower case as described in <emu-xrefhref="#sec-case-sensitivity-and-case-mapping"></emu-xref>.
270
-
1. Return _code_.
269
+
1.If_code_uses any of the backwards compatibility syntax described in <ahref="https://unicode.org/reports/tr35/#BCP_47_Conformance">Unicode Technical Standard #35 LDML § 3.3 BCP 47 Conformance</a>, throw a *RangeError* exception.
270
+
1. Return the ASCII-lowercase of _code_.
271
271
1. If _type_ is *"dateTimeField"*, then
272
272
1. If the result of IsValidDateTimeFieldCode(_code_) is *false*, throw a *RangeError* exception.
273
273
1. Return _code_.
274
274
1.Assert:_type_ is *"currency"*.
275
275
1. If ! IsWellFormedCurrencyCode(_code_) is *false*, throw a *RangeError* exception.
276
-
1. Let _code_ be the result of mapping _code_ to upper case as described in <emu-xrefhref="#sec-case-sensitivity-and-case-mapping"></emu-xref>.
0 commit comments