-
Notifications
You must be signed in to change notification settings - Fork 111
Description
I think the spec text of "first substring" and "the first ... sequence" is confusing and misleading
There won't be a second... but the text mislead the reader to think about how to deal with the "second and rest"
A. In ApplyUnicodeExtensionToTag ( tag, options, relevantExtensionKeys )
https://tc39.es/ecma402/#sec-apply-unicode-extension-to-tag
"a. Let extension be the String value consisting of the first substring of tag that is a Unicode locale extension sequence."
The "first substring" is confusing- it imply the possibility of a second. Notice ApplyUnicodeExtensionToTag is only called after
"Set tag to ? ApplyOptionsToTag(tag, options)." in Intl.Locale ( tag [ , options ] ) and ApplyOptionsToTag throws if there are more than one unicode locale extension because "3. If IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception."
which IsStructurallyValidLanguageTag return true only if "contains at most one unicode_locale_extensions component,"
B. In https://tc39.es/ecma402/#sec-lookupmatcher
"1. Let extension be the String value consisting of the first substring of locale that is a Unicode locale extension sequence.
also in the note
"...also contains an [[extension]] field whose value is the first Unicode locale extension sequence within the request locale language tag."
Same as case A above, LookupMatcher is called by only ResolveLocale and all the locales are already process by CanonicalizeLocaleList which will throw if there are more than one unicode_locale_extensions component
Why do we need to have the word "first" here?
I suggest we apply an Editorial PR to change A to
"a. Let extension be the String value consisting of the
first substring of tag that is a Unicode locale extension sequence.substring of Unicode locale extension sequence within tag"
and change B to
"1. Let extension be the String value consisting of the
first substring of locale that is a Unicode locale extension sequencesubstring of Unicode locale extension sequence within locale.
also the note
"...also contains an [[extension]] field whose value is the
first Unicode locale extension sequence within the request locale language tag.substring of Unicode locale extension sequence within the request locale language tag."