Skip to content

Commit

Permalink
fixup! Editorial: Clarify operations related to merging locale data
Browse files Browse the repository at this point in the history
Canonicalize localeId before updating languageId subtags, to avoid normative changes

For example, `new Intl.Locale("az-SU", {language: "ru"}).toString()`
should continue returning "ru-AZ" rather than "ru-RU".

https://github.com/tc39/ecma402/pull/804/files#r1295536807
  • Loading branch information
gibson042 committed Aug 17, 2023
1 parent 6592189 commit 31768c1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions spec/locale.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ <h1>Intl.Locale ( _tag_ [ , _options_ ] )</h1>
1. Let _tag_ be ? ToString(_tag_).
1. Set _options_ to ? CoerceOptionsToObject(_options_).
1. If IsStructurallyValidLanguageTag(_tag_) is *false*, throw a *RangeError* exception.
1. Set _tag_ to CanonicalizeUnicodeLocaleId(_tag_).
1. Set _tag_ to ? UpdateLanguageId(_tag_, _options_).
1. Let _opt_ be a new Record.
1. Let _calendar_ be ? GetOption(_options_, *"calendar"*, ~string~, ~empty~, *undefined*).
Expand Down Expand Up @@ -72,13 +73,13 @@ <h1>Intl.Locale ( _tag_ [ , _options_ ] )</h1>
<emu-clause id="sec-updatelanguageid" type="abstract operation" oldids="sec-apply-options-to-tag">
<h1>
UpdateLanguageId (
_tag_: a language tag,
_tag_: a Unicode canonicalized locale identifier,
_options_: an Object,
): either a normal completion containing a String or a throw completion
): either a normal completion containing a language tag or a throw completion
</h1>
<dl class="header">
<dt>description</dt>
<dd>It updates the <code>unicode_language_id</code> subtags in _tag_ from the corresponding properties of _options_.</dd>
<dd>It updates the <code>unicode_language_id</code> subtags in _tag_ from the corresponding properties of _options_ and returns the <emu-xref href="#sec-isstructurallyvalidlanguagetag">structurally valid</emu-xref> but non-canonicalized result.</dd>
</dl>
<emu-alg>
1. Let _languageId_ be the longest prefix of _tag_ matched by the <code>unicode_language_id</code> Unicode locale nonterminal.
Expand Down

0 comments on commit 31768c1

Please sign in to comment.