diff --git a/spec.html b/spec.html
index b9c46f5..8b776f0 100644
--- a/spec.html
+++ b/spec.html
@@ -12,153 +12,126 @@
Locale Objects
The Intl.Locale Constructor
- The Locale constructor is a standard built-in property of the Intl object. Behaviour common to all service constructor properties of the Intl object is specified in .
+ The Locale constructor is a standard built-in property of the Intl object.
-
- Supported options
-
-
-
- Option |
- Extension key |
- Internal slot |
-
-
-
- calendar |
- ca |
- [[Calendar]] |
-
-
- collation |
- co |
- [[Collation]] |
-
-
- hourCycle |
- hc |
- [[HourCycle]] |
-
-
- caseFirst |
- kf |
- [[CaseFirst]] |
-
-
- numeric |
- kn |
- [[Numeric]] |
-
-
- numberingSystem |
- nu |
- [[NumberingSystem]] |
-
-
-
-
-
- ApplyOptionsToTag( tag, options )
+ ApplyOptionsToTag( _tag_, _options_ )
The following algorithm refers to RFC 5646's Language-Tag grammar.
- 1. Set _tag_ to ? ToString(_tag_).
+ 1. Assert: Type(_tag_) is String.
1. If IsStructurallyValidLanguageTag(_tag_) is *false*, throw a *RangeError* exception.
- 1. If _tag_ matches the `langtag` production,
- 1. Let _language_ be ? Get(_options_, `"language"`).
- 1. If _language_ is not *undefined*,
- 1. Set _language_ to ? ToString(_language_).
+ 1. If _tag_ matches the `langtag` production, then
+ 1. Let _language_ be ? GetOption(_options_, `"language"`, `"string"`, *undefined*, *undefined*).
+ 1. If _language_ is not *undefined*, then
1. If _language_ does not match the `language` production, throw a *RangeError* exception.
1. Set _tag_ to _tag_ with the substring corresponding to the `language` production replaced by the string _language_.
- 1. Let _script_ be ? Get(_options_, `"script"`).
- 1. If _script_ is not *undefined*,
- 1. Set _script_ to ? ToString(_script_).
+ 1. Let _script_ be ? GetOption(_options_, `"script"`, `"string"`, *undefined*, *undefined*).
+ 1. If _script_ is not *undefined*, then
1. If _script_ does not match the `script` production, throw a *RangeError* exception.
- 1. If _tag_ does not contain a `script` production,
+ 1. If _tag_ does not contain a `script` production, then
1. Set _tag_ to the concatenation of the `language` production of _tag_, `"-"`, _script_, and the rest of _tag_.
1. Else,
- 1. Set _tag_ to _tag_ with the substring corresponding to the `region` production replaced by the string _language_.
- 1. Let _region_ be ? Get(_options_, `"region"`).
- 1. If _region_ is not *undefined*,
- 1. Set _region_ to ? ToString(_region_).
+ 1. Set _tag_ to _tag_ with the substring corresponding to the `script` production replaced by the string _script_.
+ 1. Let _region_ be ? GetOption(_options_, `"region"`, `"string"`, *undefined*, *undefined*).
+ 1. If _region_ is not *undefined*, then
1. If _region_ does not match the `region` production, throw a *RangeError* exception.
- 1. If _tag_ does not contain a `region` production,
- 1. Set _tag_ to the concatenation of the `language` production of _tag_, the substring corresponding to the `"-" script` production if present, `"-"`, _script_, and the rest of _tag_.
+ 1. If _tag_ does not contain a `region` production, then
+ 1. Set _tag_ to the concatenation of the `language` production of _tag_, the substring corresponding to the `"-" script` production if present, `"-"`, _region_, and the rest of _tag_.
1. Else,
- 1. Set _tag_ to _tag_ with the substring corresponding to the `region` production replaced by the string _language_.
+ 1. Set _tag_ to _tag_ with the substring corresponding to the `region` production replaced by the string _region_.
1. Return CanonicalizeLanguageTag(_tag_).
-
- FindExtension ( _extension_, _key_ )
-
- The abstract operation FindExtension is called with _extension_, which must be a Unicode locale extension sequence, and String _key_. This operation returns start and end indices for the type subtags for _key_ by performing the following steps:
+
+ ApplyUnicodeExtensionToTag( _tag_, _options_, _relevantExtensionKeys_ )
+
+ The following algorithm refers to RFC 5646's Language-Tag grammar.
+
- 1. Assert: The number of elements in _key_ is 2.
+ 1. Assert: Type(_tag_) is String.
+ 1. If _tag_ does not match the `langtag` production, then
+ 1. Let _result_ be a new Record.
+ 1. Repeat for each element _key_ of _relevantExtensionKeys_ in List order,
+ 1. Set result.[[<_key_>]] to *undefined*.
+ 1. Set _result_.[[locale]] to _tag_.
+ 1. Return _result_.
+ 1. If _tag_ contains a substring that is a Unicode locale extension sequence, then
+ 1. Let _extension_ be the String value consisting of the first substring of _tag_ that is a Unicode locale extension sequence.
+ 1. Else,
+ 1. Let _extension_ be the empty String.
+ 1. Let _keywords_ be the empty List.
1. Let _size_ be the number of elements in _extension_.
- 1. Let _searchValue_ be the concatenation of `"-"`, _key_, and `"-"`.
- 1. Let _pos_ be Call(%StringProto_indexOf%, _extension_, « _searchValue_ »).
- 1. If _pos_ ≠ -1, then
- 1. Let _start_ be _pos_ + 4.
- 1. Let _end_ be _start_.
- 1. Let _k_ be _start_.
- 1. Let _done_ be *false*.
- 1. Repeat, while _done_ is *false*
- 1. Let _e_ be Call(%StringProto_indexOf%, _extension_, « `"-"`, _k_ »).
- 1. If _e_ = -1, let _len_ be _size_ - _k_; else let _len_ be _e_ - _k_.
- 1. If _len_ = 2, then
- 1. Let _done_ be *true*.
- 1. Else if _e_ = -1, then
- 1. Let _end_ be _size_.
- 1. Let _done_ be *true*.
- 1. Else,
- 1. Let _end_ be _e_.
- 1. Let _k_ be _e_ + 1.
- 1. Return a new Record { [[Start]]: _pos_, [[End]]: _end_ }.
- 1. Let _searchValue_ be the concatenation of `"-"` and _key_.
- 1. Let _pos_ be Call(%StringProto_indexOf%, _extension_, « _searchValue_ »).
- 1. If _pos_ ≠ -1 and _pos_ + 3 = _size_, then
- 1. Return a new Record { [[Start]]: _pos_, [[End]]: _size_ }.
- 1. Return *undefined*.
-
-
-
-
- UnicodeExtensionValue ( _extension_, _key_ )
-
- The abstract operation UnicodeExtensionValue is called with _extension_, which must be a Unicode locale extension sequence, and String _key_. This operation returns the type subtags for _key_ by performing the following steps:
-
-
- 1. Let _range_ be FindExtension(_extension_, _key_).
- 1. If _range_ is *undefined*, return *undefined*.
- 1. If _range_.[[Start]] + 4 ≥ _range_.[[End]], return an empty String.
- 1. Otherwise, return a String value equal to the substring of _extension_ from _range_.[[Start]] + 4 (inclusive) to _range_.[[End]] (exclusive).
-
-
-
-
- UnusedExtensions ( r )
-
- 1. Let _extension_ be _r_.[[extension]].
- 1. For _key_ in %Locale%.[[RelevantExtensionKeys]],
- 1. Let _done_ be *false*.
- 1. Repeat, while _done_ is *false*,
- 1. Let _range_ be FindExtension(_extension_, _key_).
- 1. If _range_ is *undefined*, set _done_ to *true*.
- 1. Otherwise, set _extension_ to the concatenation of the substring of _extension_ from the beginning to _range_.[[Start]] with the substring of _extension_ from _range_.[[End]] to the end of the string.
- 1. If _extension_ begins with `"-u-"`, set _extension_ to the substring of _extension_ beginning from its fourth index.
- 1. Return _extension_.
+ 1. Let _key_ be `"attributes"`.
+ 1. Let _value_ be the empty String.
+ 1. Let _k_ be 3.
+ 1. Repeat, while _k_ < _size_
+ 1. Let _e_ be ! Call(%StringProto_indexOf%, _extension_, « `"-"`, _k_ »).
+ 1. If _e_ = -1, let _len_ be _size_ - _k_; else let _len_ be _e_ - _k_.
+ 1. Let _subtag_ the String value equal to the substring of _extension_ consisting of the code units at indices _k_ (inclusive) through _k_ + _len_ (exclusive).
+ 1. If _len_ = 2, then
+ 1. If _keywords_ does not contain an element whose [[Key]] is the same as _key_, then
+ 1. Append the Record{[[Key]]: _key_, [[Value]]: _value_} to _keywords_.
+ 1. Let _key_ be _subtag_.
+ 1. Let _value_ be the empty String.
+ 1. Else,
+ 1. If _value_ is not the empty String, then
+ 1. Let _value_ be the string-concatenation of _value_ and `"-"`.
+ 1. Let _value_ be the string-concatenation of _value_ and _subtag_.
+ 1. Let _k_ be _k_ + _len_ + 1.
+ 1. If _keywords_ does not contain an element whose [[Key]] is the same as _key_, then
+ 1. Append the Record{[[Key]]: _key_, [[Value]]: _value_} to _keywords_.
+ 1. Let _result_ be a new Record.
+ 1. Let _newExtension_ be `"-u"`.
+ 1. Let _entry_ be the element of _keywords_ whose [[Key]] is the same as `"attributes"`.
+ 1. If _entry_.[[Value]] is not the empty String, then
+ 1. Let _newExtension_ be the string-concatenation of _newExtension_, `"-"`, and _entry_.[[Value]].
+ 1. Remove _entry_ from _keywords_.
+ 1. Repeat for each element _key_ of _relevantExtensionKeys_ in List order,
+ 1. Let _value_ be *undefined*.
+ 1. If _keywords_ contains an element whose [[Key]] is the same as _key_, then
+ 1. Let _entry_ be the element of _keywords_ whose [[Key]] is the same as _key_.
+ 1. Let _value_ be _entry_.[[Value]].
+ 1. Remove _entry_ from _keywords_.
+ 1. Assert: _options_ has a field [[<_key_>]].
+ 1. Let _optionsValue_ be _options_.[[<_key_>]].
+ 1. If _optionsValue_ is not *undefined*, then
+ 1. Let _value_ be _optionsValue_.
+ 1. Set _result_.[[<_key_>]] to _value_.
+ 1. If _value_ is not *undefined*, then
+ 1. Assert: Type(_value_) is String.
+ 1. Let _newExtension_ be the string-concatenation of _newExtension_, `"-"`, and _key_.
+ 1. If _value_ is not the empty String, then
+ 1. Let _newExtension_ be the string-concatenation of _newExtension_, `"-"`, and _value_.
+ 1. Repeat for each element _entry_ of _keywords_ in List order,
+ 1. Let _key_ be _entry_.[[Key]].
+ 1. Let _value_ be _entry_.[[Value]].
+ 1. Let _newExtension_ be the string-concatenation of _newExtension_, `"-"`, and _key_.
+ 1. If _value_ is not the empty String, then
+ 1. Let _newExtension_ be the string-concatenation of _newExtension_, `"-"`, and _value_.
+ 1. Let _locale_ be the String value that is _tag_ with all Unicode locale extension sequences removed.
+ 1. If the number of elements in _newExtension_ is greater than 2, then
+ 1. Let _privateIndex_ be ! Call(%StringProto_indexOf%, _locale_, « `"-x-"` »).
+ 1. If _privateIndex_ = -1, then
+ 1. Let _locale_ be the concatenation of _locale_ and _newExtension_.
+ 1. Else,
+ 1. Let _preExtension_ be the substring of _locale_ from position 0, inclusive, to position _privateIndex_, exclusive.
+ 1. Let _postExtension_ be the substring of _locale_ from position _privateIndex_ to the end of the string.
+ 1. Let _locale_ be the string-concatenation of _preExtension_, _newExtension_, and _postExtension_.
+ 1. Assert: ! IsStructurallyValidLanguageTag(_locale_) is *true*.
+ 1. Let _locale_ be ! CanonicalizeLanguageTag(_locale_).
+ 1. Set _result_.[[locale]] to _locale_.
+ 1. Return _result_.
- Intl.Locale( tag[, options] )
+ Intl.Locale( _tag_ [, _options_] )
When the *Intl.Locale* function is called with an argument _tag_ and an optional argument _options_, the following steps are taken:
@@ -166,40 +139,47 @@
Intl.Locale( tag[, options] )
1. If NewTarget is *undefined*, throw a *TypeError* exception.
- 1. Let _locale_ be ? OrdinaryCreateFromConstructor(NewTarget, *%LocalePrototype%*, « [[InitializedLocale]], [[Locale]], [[Calendar]], [[Collation]], [[HourCycle]], [[CaseFirst]], [[Numeric]], [[NumberingSystem]], [[OtherExtensions]] »).
- 1. Set _tag_ to ApplyOptionsToTag(_tag_).
- 1. Let _requestedLocales_ be ? CreateArrayFromList(« _tag_ »).
+ 1. Let _relevantExtensionKeys_ be %Locale%.[[RelevantExtensionKeys]].
+ 1. Let _internalSlotsList_ be « [[InitializedLocale]], [[Locale]], [[Calendar]], [[Collation]], [[HourCycle]], [[NumberingSystem]] ».
+ 1. If _relevantExtensionKeys_ contains `"kf"`, then
+ 1. Append [[CaseFirst]] as the last element of _internalSlotsList_.
+ 1. If _relevantExtensionKeys_ contains `"kn"`, then
+ 1. Append [[Numeric]] as the last element of _internalSlotsList_.
+ 1. Let _locale_ be ? OrdinaryCreateFromConstructor(NewTarget, *%LocalePrototype%*, _internalSlotsList_).
+ 1. If Type(_tag_) is not String or Object, throw a *TypeError* exception.
+ 1. If Type(_tag_) is Object and _tag_ has an [[InitializedLocale]] internal slot, then
+ 1. Let _tag_ be _tag_.[[Locale]].
+ 1. Else,
+ 1. Let _tag_ be ? ToString(_tag_).
1. If _options_ is *undefined*, then
- 1. Let _options_ be ObjectCreate(*null*).
+ 1. Let _options_ be ! ObjectCreate(*null*).
1. Else
1. Let _options_ be ? ToObject(_options_).
- 1. Set _opt_.[[localeMatcher]] to `"best fit"`.
- 1. Let _calendar_ be ? Get(_options_, `"calendar"`).
- 1. If _calendar_ is not *undefined*, set _calendar_ to ? ToString(_calendar_).
+ 1. Set _tag_ to ? ApplyOptionsToTag(_tag_, _options_).
+ 1. Let _opt_ be a new Record.
+ 1. Let _calendar_ be ? GetOption(_options_, `"calendar"`, `"string"`, *undefined*, *undefined*).
1. Set _opt_.[[ca]] to _calendar_.
- 1. Let _collation_ be ? Get(_options_, `"collation"`).
- 1. If _collation_ is not *undefined*, set _collation_ to ? ToString(_collation_).
+ 1. Let _collation_ be ? GetOption(_options_, `"collation"`, `"string"`, *undefined*, *undefined*).
1. Set _opt_.[[co]] to _collation_.
1. Let _hc_ be ? GetOption(_options_, `"hourCycle"`, `"string"`, « `"h11"`, `"h12"`, `"h23"`, `"h24"` », *undefined*).
1. Set _opt_.[[hc]] to _hc_.
1. Let _kf_ be ? GetOption(_options_, `"caseFirst"`, `"string"`, « `"upper"`, `"lower"`, `"false"` », *undefined*).
1. Set _opt_.[[kf]] to _kf_.
1. Let _kn_ be ? GetOption(_options_, `"numeric"`, `"boolean"`, *undefined*, *undefined*).
- 1. If _kn_ is not *undefined*, set _kn_ to ? ToString(_kn_).
+ 1. If _kn_ is not *undefined*, set _kn_ to ! ToString(_kn_).
1. Set _opt_.[[kn]] to _kn_.
- 1. Let _numberingSystem_ be ? Get(_options_, `"numberingSystem"`).
- 1. If _numberingSystem_ is not *undefined*, set _numberingSystem_ to ? ToString(_numeringSystem_).
+ 1. Let _numberingSystem_ be ? GetOption(_options_, `"numberingSystem"`, `"string"`, *undefined*, *undefined*).
1. Set _opt_.[[nu]] to _numeringSystem_.
- 1. Let _localeData_ be %Locale%.[[LocaleData]].
- 1. Let _r_ be ResolveLocale( %Locale%.[[AvailableLocales]], _requestedLocales_, _opt_, %Locale%.[[RelevantExtensionKeys]], _localeData_).
+ 1. Let _r_ be ! ApplyUnicodeExtensionToTag(_tag_, _opt_, _relevantExtensionKeys_).
1. Set _locale_.[[Locale]] to _r_.[[locale]].
1. Set _locale_.[[Calendar]] to _r_.[[ca]].
1. Set _locale_.[[Collation]] to _r_.[[co]].
1. Set _locale_.[[HourCycle]] to _r_.[[hc]].
- 1. Set _locale_.[[CaseFirst]] to _r_.[[kf]].
- 1. Set _locale_.[[Numeric]] to _r_.[[kn]].
+ 1. If _relevantExtensionKeys_ contains `"kf"`, then
+ 1. Set _locale_.[[CaseFirst]] to _r_.[[kf]].
+ 1. If _relevantExtensionKeys_ contains `"kn"`, then
+ 1. Set _locale_.[[Numeric]] to _r_.[[kn]].
1. Set _locale_.[[NumberingSystem]] to _r_.[[nu]].
- 1. Set _locale_.[[OtherExtensions]] to UnusedExtensions(_r_).
1. Set _locale_.[[InitializedLocale]] to *true*.
1. Return _locale_.
@@ -228,39 +208,8 @@ Intl.Locale.prototype
Internal slots
- The value of the [[AvailableLocales]] internal slot is the List of all two- or three-character strings with code points in the range `"a"` through `"z"`. This will contain at least the union of %DateTimeFormat%.[[AvailableLocales]], %NumberFormat%.[[AvailableLocales]] and %Collator%.[[AvailableLocales]].
-
-
-
- The value of the [[RelevantExtensionKeys]] internal slot is « `"ca"`, `"co"`, `"hc"`, `"kf"`, `"kn"`, `"nu"` ».
- %Collator%.[[RelevantExtensionKeys]] contains `"kf"`, then %Locale%.[[RelevantExtensionKeys]] includes `"kf"`.
- %Collator%.[[RelevantExtensionKeys]] contains `"kn"`, then %Locale%.[[RelevantExtensionKeys]] includes `"kn"`.
+ The value of the [[RelevantExtensionKeys]] internal slot is « `"ca"`, `"co"`, `"hc"`, `"kf"`, `"kn"`, `"nu"` ». If %Collator%.[[RelevantExtensionKeys]] does not contain `"kf"`, then remove `"kf"` from %Locale%.[[RelevantExtensionKeys]]. If %Collator%.[[RelevantExtensionKeys]] does not contain `"kn"`, then remove `"kn"` from %Locale%.[[RelevantExtensionKeys]].
-
-
- The value of the [[LocaleData]] internal slot is implementation defined within the constraints described in and the following additional constraints:
-
-
-
- -
- For each supported locale _locale_, %Locale%.[[LocaleData]][[<_locale_>]].[[ca]] contains %DateTimeFormat%.[[LocaleData]][[<_locale_>]].[[ca]]
-
- -
- For each supported locale _locale_, %Locale%.[[LocaleData]][[<_locale_>]].[[co]] contains %Collator%.[[LocaleData]][[<_locale_>]].[[co]]
-
- -
- [[LocaleData]][[<_locale_>]].[[hc]] must be « *null*, `"h11"`, `"h12"`, `"h23"`, `"h24"` » for all locale values.
-
- -
- For each supported locale _locale_, %Locale%.[[LocaleData]][[<_locale_>]].[[kf]] contains %Collator%.[[LocaleData]][[<_locale_>]].[[kf]]
-
- -
- For each supported locale _locale_, %Locale%.[[LocaleData]][[<_locale_>]].[[kn]] contains %Collator%.[[LocaleData]][[<_locale_>]].[[kn]]
-
- -
- For each supported locale _locale_, %Locale%.[[LocaleData]][[<_locale_>]].[[nu]] contains %DateTimeFormat%.[[LocaleData]][[<_locale_>]].[[nu]]
-
-
@@ -268,10 +217,7 @@ Internal slots
Properties of the Intl.Locale Prototype Object
- The Intl.Locale prototype object is itself an Intl.Locale instance as specified in , whose internal slots are set as if it had been constructed by the expression Construct(*%Locale%*).
-
-
- In the following descriptions of functions that are properties or [[Get]] attributes of properties of *%LocalePrototype%*, the phrase "this Locale object" refers to the object that is the this value for the invocation of the function; a *TypeError* exception is thrown if the this value is not an object or an object.
+ The Intl.Locale prototype object is itself an ordinary object. %LocalePrototype% is not an Intl.Locale instance and does not have an [[InitializedLocale]] internal slot or any of the other internal slots of Intl.Locale instance objects.
@@ -294,37 +240,14 @@ Intl.Locale.prototype[ @@toStringTag ]
-
- LocaleToString ( loc )
-
-
- 1. Assert: _loc_ has an [[InitializedLocale]] internal slot.
- 1. Let _locale_ be _loc_.[[Locale]].
- 1. Let _extension_ be an empty String.
- 1. For each row in , except the header row, in table order, do:
- 1. Let _name_ be the name given in the Option column of the row.
- 1. Let _slot_ be the Internal Slot column of the row.
- 1. Let _value_ be _locale_.[[<_slot_>]].
- 1. If _value_ is not *undefined*,
- 1. Let _kvp_ be a String value produced by concatenating `"-"`, _key_, `"-"`, and ! ToString(_value_).
- 1. Set _extension_ to a String value produced by concatenating _extension_ and _kvp_.
- 1. Set _extension_ to a String value produced by concatenating _extension_ and _loc_.[[OtherExtensions]].
- 1. If _extension_ is not empty, then,
- 1. If _extension_ does not have `"-"` as its third character, let _extension_ be the concatenation of `"-u"` and _extension_.
- 1. Let _result_ be a String value produced by concatenating _locale_ and _extension_.
- 1. Return _result_.
- 1. Else,
- 1. Return _locale_.
-
-
-
Intl.Locale.prototype.toString ()
1. Let _loc_ be the *this* value.
- 1. If Type(_loc_) is not Object, or _loc_ does not have an [[InitializedLocale]] internal slot, throw a *TypeError* exception.
- 1. Return LocaleToString(_loc_).
+ 1. If Type(_loc_) is not Object or _loc_ does not have an [[InitializedLocale]] internal slot, then
+ 1. Throw a *TypeError* exception.
+ 1. Return _loc_.[[Locale]].
@@ -333,7 +256,8 @@ get Intl.Locale.prototype.calendar
`Intl.Locale.prototype.calendar` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:
1. Let _loc_ be the *this* value.
- 1. If Type(_loc_) does not have an [[InitializedLocale]] internal slot, throw a *TypeError* exception.
+ 1. If Type(_loc_) is not Object or _loc_ does not have an [[InitializedLocale]] internal slot, then
+ 1. Throw a *TypeError* exception.
1. Return _loc_.[[Calendar]].
@@ -343,7 +267,8 @@ get Intl.Locale.prototype.collation
`Intl.Locale.prototype.collation` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:
1. Let _loc_ be the *this* value.
- 1. If Type(_loc_) does not have an [[InitializedLocale]] internal slot, throw a *TypeError* exception.
+ 1. If Type(_loc_) is not Object or _loc_ does not have an [[InitializedLocale]] internal slot, then
+ 1. Throw a *TypeError* exception.
1. Return _loc_.[[Collation]].
@@ -353,18 +278,20 @@ get Intl.Locale.prototype.hourCycle
`Intl.Locale.prototype.hourCycle` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:
1. Let _loc_ be the *this* value.
- 1. If Type(_loc_) does not have an [[InitializedLocale]] internal slot, throw a *TypeError* exception.
+ 1. If Type(_loc_) is not Object or _loc_ does not have an [[InitializedLocale]] internal slot, then
+ 1. Throw a *TypeError* exception.
1. Return _loc_.[[HourCycle]].
get Intl.Locale.prototype.caseFirst
- This property only exists if %Collator%.[[RelevantExtensionKeys]] contains `"kf"`.
+ This property only exists if %Locale%.[[RelevantExtensionKeys]] contains `"kf"`.
`Intl.Locale.prototype.caseFirst` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:
1. Let _loc_ be the *this* value.
- 1. If Type(_loc_) does not have an [[InitializedLocale]] internal slot, throw a *TypeError* exception.
+ 1. If Type(_loc_) is not Object or _loc_ does not have an [[InitializedLocale]] internal slot, then
+ 1. Throw a *TypeError* exception.
1. Return _loc_.[[CaseFirst]].
@@ -375,7 +302,8 @@ get Intl.Locale.prototype.numeric
`Intl.Locale.prototype.numeric` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:
1. Let _loc_ be the *this* value.
- 1. If Type(_loc_) does not have an [[InitializedLocale]] internal slot, throw a *TypeError* exception.
+ 1. If Type(_loc_) is not Object or _loc_ does not have an [[InitializedLocale]] internal slot, then
+ 1. Throw a *TypeError* exception.
1. Return _loc_.[[Numeric]].
@@ -385,7 +313,8 @@ get Intl.Locale.prototype.numberingSystem
`Intl.Locale.prototype.numberingSystem` is an accessor property whose set accessor function is *undefined*. Its get accessor function performs the following steps:
1. Let _loc_ be the *this* value.
- 1. If Type(_loc_) does not have an [[InitializedLocale]] internal slot, throw a *TypeError* exception.
+ 1. If Type(_loc_) is not Object or _loc_ does not have an [[InitializedLocale]] internal slot, then
+ 1. Throw a *TypeError* exception.
1. Return _loc_.[[NumberingSystem]].
@@ -395,7 +324,8 @@ get Intl.Locale.prototype.language
`Intl.Locale.prototype.language` is an accessor property whose set accessor function is *undefined*. The following algorithm refers to RFC 5646's Language-Tag grammar. Its get accessor function performs the following steps:
1. Let _loc_ be the *this* value.
- 1. If Type(_loc_) does not have an [[InitializedLocale]] internal slot, throw a *TypeError* exception.
+ 1. If Type(_loc_) is not Object or _loc_ does not have an [[InitializedLocale]] internal slot, then
+ 1. Throw a *TypeError* exception.
1. Let _locale_ be _loc_.[[Locale]].
1. If _locale_ does not match the `langtag` production, return *undefined*.
1. Return the substring of _locale_ corresponding to the `language` production.
@@ -407,10 +337,11 @@ get Intl.Locale.prototype.script
`Intl.Locale.prototype.script` is an accessor property whose set accessor function is *undefined*. The following algorithm refers to RFC 5646's Language-Tag grammar. Its get accessor function performs the following steps:
1. Let _loc_ be the *this* value.
- 1. If Type(_loc_) does not have an [[InitializedLocale]] internal slot, throw a *TypeError* exception.
+ 1. If Type(_loc_) is not Object or _loc_ does not have an [[InitializedLocale]] internal slot, then
+ 1. Throw a *TypeError* exception.
1. Let _locale_ be _loc_.[[Locale]].
1. If _locale_ does not match the `langtag` production, return *undefined*.
- 1. If _locale_ contains a no repetitions of the `["-" script]` sequence, return *undefined*.
+ 1. If _locale_ does not contain the `["-" script]` sequence, return *undefined*.
1. Return the substring of _locale_ corresponding to the `script` production.
@@ -420,10 +351,11 @@ get Intl.Locale.prototype.region
`Intl.Locale.prototype.region` is an accessor property whose set accessor function is *undefined*. The following algorithm refers to RFC 5646's Language-Tag grammar. Its get accessor function performs the following steps:
1. Let _loc_ be the *this* value.
- 1. If Type(_loc_) does not have an [[InitializedLocale]] internal slot, throw a *TypeError* exception.
+ 1. If Type(_loc_) is not Object or _loc_ does not have an [[InitializedLocale]] internal slot, then
+ 1. Throw a *TypeError* exception.
1. Let _locale_ be _loc_.[[Locale]].
1. If _locale_ does not match the `langtag` production, return *undefined*.
- 1. If _locale_ contains a no repetitions of the `["-" region]` sequence, return *undefined*.
+ 1. If _locale_ does not contain the `["-" region]` sequence, return *undefined*.
1. Return the substring of _locale_ corresponding to the `region` production.
@@ -456,9 +388,9 @@ CanonicalizeLocaleList ( _locales_ )
1. If _kPresent_ is *true*, then
1. Let _kValue_ be ? Get(_O_, _Pk_).
1. If Type(_kValue_) is not String or Object, throw a *TypeError* exception.
- 1. If Type(_kValue_) is Object and _kValue_ has an [[InitializedLocale]] internal slot,
- 1. Let _tag_ be LocaleToString(_kValue_).
- 1. Otherwise,
+ 1. If Type(_kValue_) is Object and _kValue_ has an [[InitializedLocale]] internal slot, then
+ 1. Let _tag_ be _kValue_.[[Locale]].
+ 1. Else,
1. Let _tag_ be ? ToString(_kValue_).
1. If IsStructurallyValidLanguageTag(_tag_) is *false*, throw a *RangeError* exception.
1. Let _canonicalizedTag_ be CanonicalizeLanguageTag(_tag_).