EcmaScript402 spec, collation property issue
ecmascript at norbertlindenberg.com
Thu Aug 16 17:55:21 PDT 2012
I think the spec covers this, but please verify that it all works as intended:
The collation values an implementation is allowed to recognize are specified by sections 9.1 and 10.2.3.
- [[sortLocaleData]] and [[searchLocaleData]] (for Intl.Collator) ... are objects that have properties for each locale contained in [[availableLocales]]. The value of each of these properties must be an object that has properties for each key contained in [[relevantExtensionKeys]]. The value of each of these properties must be a non-empty array of those values defined in Unicode Technical Standard 35 for the given key that are supported by the implementation for the given locale, with the first element providing the default value.
- The value of the [[relevantExtensionKeys]] internal property is an array that must include the element "co", may include any or all of the elements "kn", "kk", "kf", and must not include any other elements.
- The first element of [[sortLocaleData]][locale].co and [[searchLocaleData]][locale].co must be null for all locale values.
- The values "standard" and "search" must not be used as elements in any [[sortLocaleData]][locale].co and [[searchLocaleData]][locale].co array.
The mapping to "default" is then handled by the ResolveLocale and InitializeCollator abstract operations:
When processing key "co", step 11.c of ResolveLocale sets keyLocaleData to either [[sortLocaleData]][locale].co or [[searchLocaleData]][locale].co. Based on the content of these as specified above, step 11.d sets value to null, and step 11.g.ii.b cannot find "standard", "search", or "invalid" in keyLocaleData, so step 11.g.ii.c doesn't change value. Step 19.b.iii of InitializeCollator then converts null to "default".
On Aug 16, 2012, at 16:24 , Nebojša Ćirić wrote:
> Spec says:
> [[collation]] is a String value with the “type” given in Unicode Technical Standard 35 for the collation,
> except that the values "standard" and "search" are not allowed, while the value "default" is allowed.
> Also test intl402/ch10/10.1/10.1.1_19_b.js expects "default" if "de-u-co-invalid" was passed in.
> I think that we need to say what happens when "standard" and "search" are specified in -co- extension (test expects "default" value). I couldn't find that in the spec.
> If the -co-value is not in the list of allowed words test expects "default", but I think spec only covers value of null.
> I would add (with references):
> "If co Unicode extension has a value that is not in the bcp47 list, or the value is null, standard or search, we replace it with 'default'."
> If that's too strong, we can say that implementations are free to recognize any keyword, except for null, search and standard (those 3 get replaced with "default").
> Nebojša Ćirić
> es-discuss mailing list
> es-discuss at mozilla.org
More information about the es-discuss