RegionPreference doesn't seem to match UTS 35, see also https://unicode.org/reports/tr35/tr35.html#RegionOverride.
Issues:
- CanonicalUnicodeSubdivision calls CanonicalizeUnicodeLocaleId to replace region aliases. It's unclear if this is valid per UTS 35. For example in Processing LocaleIds,
unicode_subdivision_id replaces subdivisions using <subdivisionAlias> without first canonicalizing the subdivision's unicode_region_subtag part.
Example:
js> new Intl.Locale("en-u-rg-826zzzz").getHourCycles()[0]
"h12"
js> new Intl.Locale("en-u-rg-gbzzzz").getHourCycles()[0]
"h23"
Per the current spec text, both calls should return "h23". (826 is the numeric region for GB.)
- Region Override defines that only "regular" and "unknown" regions are allowed and any other value should be ignored. Validity is checked against https://github.com/unicode-org/cldr/blob/main/common/validity/region.xml. I'm not sure if the "unknown" region should be accepted, though, because at least ICU4C seems to ignore it.
Examples:
js> new Intl.Locale("en-JP-u-rg-001zzzz").getCalendars()
["gregory", "japanese"]
The macro-region 001 has <calendarPreference> data, but the region override is ignored nonetheless.
js> new Intl.Locale("en-JP-u-rg-zzzzzz").getCalendars()
["gregory", "japanese"]
js> new Intl.Locale("ja-u-rg-zzzzzz-sd-thzzzz").getCalendars()
["buddhist", "gregory"]
Region override uses the "unknown" region ZZ, but it's ignored and instead the calendar preference from JP resp. TH is used.
js> new Intl.Locale("ja-u-sd-euzzzz").getCalendars()
["gregory", "japanese"]
js> new Intl.Locale("ja-u-sd-thzzzz").getCalendars()
["buddhist", "gregory"]
The subdivision using the macro-region EU is ignored and instead the calendar preference from JP (added through likely subtags) is used. When using a regular region (TH), the sd Unicode extension value is used.
Existing (browser) implementations directly call into ICU4C and don't implement any of the ECMA-402 specific operations, so changing the spec won't cause any web-compatibility issues. And ICU4C seems to ignore both region aliases and non-regular regions.
ICU4C is only buggy when using an empty Unicode extension value:
d8> new Intl.Locale("ja-u-rg").getCalendars()
["gregory", "islamic", "islamic-civil", "islamic-tbla"]
This probably happens because the empty string is treated as a shorthand for yes (either directly or by first replacing with the value true), and yes starts with the region code for YE (Yemen).
RegionPreference doesn't seem to match UTS 35, see also https://unicode.org/reports/tr35/tr35.html#RegionOverride.
Issues:
unicode_subdivision_idreplaces subdivisions using<subdivisionAlias>without first canonicalizing the subdivision'sunicode_region_subtagpart.Example:
Per the current spec text, both calls should return
"h23". (826is the numeric region forGB.)Examples:
The macro-region
001has<calendarPreference>data, but the region override is ignored nonetheless.Region override uses the "unknown" region
ZZ, but it's ignored and instead the calendar preference fromJPresp.THis used.The subdivision using the macro-region
EUis ignored and instead the calendar preference fromJP(added through likely subtags) is used. When using a regular region (TH), thesdUnicode extension value is used.Existing (browser) implementations directly call into ICU4C and don't implement any of the ECMA-402 specific operations, so changing the spec won't cause any web-compatibility issues. And ICU4C seems to ignore both region aliases and non-regular regions.
ICU4C is only buggy when using an empty Unicode extension value:
This probably happens because the empty string is treated as a shorthand for
yes(either directly or by first replacing with the valuetrue), andyesstarts with the region code forYE(Yemen).