diff --git a/spec/locale.html b/spec/locale.html index a8049aaf..48f78e48 100644 --- a/spec/locale.html +++ b/spec/locale.html @@ -492,8 +492,9 @@

1. Let _baseName_ be GetLocaleBaseName(_locale_). - 1. Assert: The first subtag of _baseName_ can be matched by the unicode_language_subtag Unicode locale nonterminal. - 1. Return the first subtag of _baseName_. + 1. Let _subtags_ be StringSplitToList(_baseName_, *"-"*). + 1. Assert: _subtags_[0] is matched by the unicode_language_subtag Unicode locale nonterminal. + 1. Return _subtags_[0]. @@ -507,8 +508,10 @@

1. Let _baseName_ be GetLocaleBaseName(_locale_). - 1. Assert: _baseName_ contains at most one subtag that can be matched by the unicode_script_subtag Unicode locale nonterminal. - 1. If _baseName_ contains a subtag matched by the unicode_script_subtag Unicode locale nonterminal, return that subtag. + 1. NOTE: A unicode_script_subtag subtag is only valid immediately after an initial unicode_language_subtag subtag. In that position, it cannot be confused with any other valid subtag because all their productions are disjoint. + 1. Let _subtags_ be StringSplitToList(_baseName_, *"-"*). + 1. Assert: _subtags_[0] is matched by the unicode_language_subtag Unicode locale nonterminal. + 1. If _subtags_ has at least 2 elements and _subtags_[1] is matched by the unicode_script_subtag Unicode locale nonterminal, return _subtags_[1]. 1. Return *undefined*. @@ -523,11 +526,11 @@

1. Let _baseName_ be GetLocaleBaseName(_locale_). - 1. NOTE: A unicode_region_subtag subtag is only valid immediately after an initial unicode_language_subtag subtag, optionally with a single unicode_script_subtag subtag between them. In that position, unicode_region_subtag cannot be confused with any other valid subtag because all their productions are disjoint. - 1. Assert: The first subtag of _baseName_ can be matched by the unicode_language_subtag Unicode locale nonterminal. - 1. Let _baseNameTail_ be the suffix of _baseName_ following the first subtag. - 1. Assert: _baseNameTail_ contains at most one subtag that can be matched by the unicode_region_subtag Unicode locale nonterminal. - 1. If _baseNameTail_ contains a subtag matched by the unicode_region_subtag Unicode locale nonterminal, return that subtag. + 1. NOTE: A unicode_region_subtag subtag is only valid immediately after an initial unicode_language_subtag subtag, optionally with a single unicode_script_subtag subtag between them. In that position, it cannot be confused with any other valid subtag because all their productions are disjoint. + 1. Let _subtags_ be StringSplitToList(_baseName_, *"-"*). + 1. Assert: _subtags_[0] is matched by the unicode_language_subtag Unicode locale nonterminal. + 1. If _subtags_ has at least 2 elements and _subtags_[1] is matched by the unicode_region_subtag Unicode locale nonterminal, return _subtags_[1]. + 1. If _subtags_ has at least 3 elementss and _subtags_[2] is matched by the unicode_region_subtag Unicode locale nonterminal, return _subtags_[2]. 1. Return *undefined*. @@ -542,8 +545,9 @@

1. Let _baseName_ be GetLocaleBaseName(_locale_). - 1. NOTE: Each subtag in _baseName_ that is preceded by *"-"* is either a unicode_script_subtag, unicode_region_subtag, or unicode_variant_subtag, but any substring matched by unicode_variant_subtag is strictly longer than any prefix thereof which could also be matched by one of the other productions. + 1. NOTE: Each non-initial subtag in _baseName_ is either a unicode_script_subtag, unicode_region_subtag, or unicode_variant_subtag, whose productions are all mutually disjoint. 1. Let _subtags_ be StringSplitToList(_baseName_, *"-"*). + 1. Assert: _subtags_[0] is matched by the unicode_language_subtag Unicode locale nonterminal. 1. Let _dashIndex_ be the length of _subtags_[0]. 1. Remove the first element from _subtags_. 1. For each String _subtag_ of _subtags_, do