Open Bug 1693576 Opened 4 months ago Updated 12 days ago

Implement Intl.LocaleInfo


(Core :: JavaScript: Internationalization API, enhancement, P3)






(Reporter: ystartsev, Assigned: anba)


(Blocks 1 open bug, )


(Keywords: dev-doc-needed, Whiteboard: [DocArea=JS])


(8 files)

Currently at stage 2

Component: JavaScript Engine → JavaScript: Internationalization API
No longer depends on: 1693575

Only a draft patch for now until the various issues I've reported at have been resolved resp. clarified.

Assignee: nobody → andrebargull
Duplicate of this bug: 1713656
Attachment #9222188 - Attachment description: Bug 1693576: Implement Intl Locale Info API proposal. → Bug 1693576 - Part 1: Add CompareStrings overload for linear strings. r=yulia!

LocaleObject doesn't use a reserved slot to store the [[Calendar]] internal
slot, so we have to extract any Unicode "ca" extension sequences directly
from the locale identifier via GetUnicodeExtension().

If no "ca" Unicode keyword is present in the locale, we're calling into ICU
to retrieve all commonly used calendars of the locale (via

ICU has certain internal limits on how large the input locale can be, so to make
sure we don't run into these limits, the LocaleLSR helper class extracts the
language, script, and region subtags of a locale. The LSR-subtags are guaranteed
to fit into the ICU limits.

Depends on D115223

Similar to part 2, but this time for collations instead of calendars.

Depends on D116467

Unfortunately support for hour cycles is more convoluted, because ICU doesn't
have public APIs to get the complete set of supported hour cycles for a locale:

There is udatpg_getDefaultHourCycle(), but that function only returns the
default hour cycle, but not any additionally allowed hour cycles. So we have to
do it the hard way and directly read ICU resource bundles to get the data we
need for this feature.

Depends on D116468

There is no way to figure out which numbering systems are commonly used by a
specific locale (because this data isn't even recorded in CLDR), so we can
only return the default numbering system.

Depends on D116469

Time zone names are canonicalised and sorted alphabetically. Canonicalisation
has the usual problem that ICU uses CLDR time zone canonicalisation, whereas
the spec requires IANA canonicalisation, so we have to perform some extra
steps here.

Depends on D116470

This code is based on the existing code in js::intl_GetCalendarInfo() with
the exception of gracefully handling UCAL_WEEKEND_{ONSET,CEASE} instead of
throwing an error.

Depends on D116472

Patches split for review, but I'm still waiting for the open spec issues to be resolved before actually requesting review.

You need to log in before you can comment on or make changes to this bug.