Normative: Add more explicit algorithms for lookups #92
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add more explicit steps which should match the results when using ICU4C.
Being more explicit which Unicode extension keys are used is important for implementations like SpiderMonkey, which has to sanitize the locale identifier before passing it to ICU4C. SpiderMonkey allows locale identifier longer than
ULOC_FULLNAME_CAPACITY
(157 characters), so we have to sanitize the locale identifier before passing it to ICU4C, otherwise ICU4C will reject the locale identifier withU_BUFFER_OVERFLOW_ERROR
. (I think this also applies to JSC.) V8 directly calls into ICU4C, so it inherits theULOC_FULLNAME_CAPACITY
restrictions and can't even createIntl.Locale
with long locale identifiers.When to use
rg
orsd
or even fall back to the default locale seems a bit arbitrarily to me, but that's the current ICU4C behaviour, so it's what users will get in browsers. 🤷a27bd64:
rg
andsd
Unicode extension keys to lookup the region."gregory"
resp."h23"
if no calendar or time data is available.df2d9cc:
rg
andsd
Unicode extension keys are ignored."ltr"
when no script metadata is available. (This case can happen if the script's metadata usesUNKNOWN
for theRTL
property or if the script is invalid.)81e9d12:
%Intl.NumberFormat%
to lookup the default numbering system.rg
andsd
Unicode extension keys are ignored."latn"
if the locale isn't found in the available locales list of%Intl.NumberFormat%
.23d08eb:
%Intl.NumberFormat%
to lookup the default numbering system.rg
andsd
Unicode extension keys are ignored.%Intl.Collator%
.Applies on top of #91.