Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normative: Add more explicit algorithms for lookups #92

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

anba
Copy link
Contributor

@anba anba commented Aug 7, 2024

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 with U_BUFFER_OVERFLOW_ERROR. (I think this also applies to JSC.) V8 directly calls into ICU4C, so it inherits the ULOC_FULLNAME_CAPACITY restrictions and can't even create Intl.Locale with long locale identifiers.

When to use rg or sd 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:

  • Use rg and sd Unicode extension keys to lookup the region.
  • Use "gregory" resp. "h23" if no calendar or time data is available.

df2d9cc:

81e9d12:

  • Use %Intl.NumberFormat% to lookup the default numbering system.
  • rg and sd Unicode extension keys are ignored.
  • Use "latn" if the locale isn't found in the available locales list of %Intl.NumberFormat%.

23d08eb:

  • Use %Intl.NumberFormat% to lookup the default numbering system.
  • rg and sd Unicode extension keys are ignored.
  • Use the default locale (!) if the locale isn't found in the available locales list of %Intl.Collator%.

Applies on top of #91.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant