ecma402
ecma402 copied to clipboard
`ApplyUnicodeExtensionToTag` and `ResolveLocale` set the `result` record's internal slots to non-canonical values
In ApplyUnicodeExtensionToTag and ResolveLocale, we loop over the provided relevant extension keys, and set the corresponding internal slot of the result record to the value present in either the locale string or options object:
6. For each element key of relevantExtensionKeys, do
...
g. Set result.[[<key>]] to value.
This happens before the values are canonicalized via InsertUnicodeExtensionAndCanonicalize:
9. If newExtension is not the empty String, then
a. Let locale be ! InsertUnicodeExtensionAndCanonicalize(locale, newExtension) .
10. Set result.[[locale]] to locale.
11. Return result.
Thus, the locale string of the corresponding Intl object is canonicalized, but the extension key internal slots are non-canonical.
The formatjs polyfill shows this issue:
import '@formatjs/intl-locale/polyfill.js'
const loc = new Intl.Locale('en', {calendar: 'islamicc'});
console.log(loc.toString());
console.log(loc.calendar);
That prints:
en-u-ca-islamic-civil
islamicc
test262 expects loc.calendar to be canonicalized (and that is how v8 and spidermonkey already behave).