Open Bug 1693576 Opened 2 years ago Updated 1 month ago

Implement Intl.LocaleInfo

Categories

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

enhancement

Tracking

()

ASSIGNED

People

(Reporter: yulia, Assigned: anba)

References

(Blocks 3 open bugs, )

Details

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

Attachments

(17 files, 1 obsolete file)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

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 https://github.com/tc39/proposal-intl-locale-info/issues have been resolved resp. clarified.

Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
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
ucal_getKeywordValuesForLocale()).

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.

Attachment #9222188 - Attachment is obsolete: true

Pass through the "commonlyUsed" parameter to ICU to be able to filter any
uncommon keyword values.

ICU's public API only provides a function to return the preferred hour cycle
(udatpg_getDefaultHourCycle()), whereas for Intl.Locale we want to be able
to determine all 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 D125570

Use the new NumberingSystem class to replace UNumberingSystem in SpiderMonkey.

Depends on D125572

Time zone functions being part of UCalendar is an internal implementation
detail of ICU4C. For the public unified Intl API we should rather follow
Temporal (or ICU4C's C++ API) and have a separate TimeZone class.

The files were moved using hg cp to preserve the file history.

Depends on D125573

  • TimeZone objects can be created with any time zone identifier, so the "Default"
    part in the name isn't correct.
  • The "TimeZone" part is no longer needed, now that there's a distinct class for
    TimeZone objects.

Therefore let's rename GetDefaultTimeZoneOffsetMs() to GetRawOffsetMs().

Depends on D125574

The filter type is UCAL_ZONE_TYPE_ANY to ensure all possible time zones are
returned, and not just CLDR canonical time zones. (CLDR canonical time zones
are different from IANA canonical time zones.)

Depends on D125575

Currently only provides a single method to retrieve the character orientation.

The default constructor was deleted because all methods are static.

Depends on D125576

The last addition for the "Intl Locale Info API" proposal.

Depends on D125577

Move CreateArrayFromList to intl/CommonFunctions so later patches in this
patch stack can use it.

Attachment #9224427 - Attachment description: Bug 1693576 - Part 2: Implement Intl.Locale.prototype.calendars. r=yulia! → WIP: Bug 1693576 - Part 11: Implement Intl.Locale.prototype.calendars.
Attachment #9224428 - Attachment description: Bug 1693576 - Part 3: Implement Intl.Locale.prototype.collations. r=yulia! → WIP: Bug 1693576 - Part 12: Implement Intl.Locale.prototype.collations.
Attachment #9224430 - Attachment description: Bug 1693576 - Part 4: Implement Intl.Locale.prototype.hourCycles. r=yulia! → WIP: Bug 1693576 - Part 13: Implement Intl.Locale.prototype.hourCycles.
Attachment #9224431 - Attachment description: Bug 1693576 - Part 5: Implement Intl.Locale.prototype.numberingSystems. r=yulia! → WIP: Bug 1693576 - Part 14: Implement Intl.Locale.prototype.numberingSystems.
Attachment #9224432 - Attachment description: Bug 1693576 - Part 6: Implement Intl.Locale.prototype.timeZones. r=yulia! → WIP: Bug 1693576 - Part 15: Implement Intl.Locale.prototype.timeZones.
Attachment #9224433 - Attachment description: Bug 1693576 - Part 7: Implement Intl.Locale.prototype.textInfo. r=yulia! → WIP: Bug 1693576 - Part 16: Implement Intl.Locale.prototype.textInfo.
Attachment #9224434 - Attachment description: Bug 1693576 - Part 8: Implement Intl.Locale.prototype.weekInfo. r=yulia! → WIP: Bug 1693576 - Part 17: Implement Intl.Locale.prototype.weekInfo.
Blocks: 1730779
Attachment #9241169 - Attachment description: Bug 1693576 - Part 9: Add a method to retrieve week day information to Calendar. r=#platform-i18n-reviewers! → Bug 1693576 - Part 8: Add a method to retrieve week day information to Calendar. r=#platform-i18n-reviewers!
Keywords: leave-open
Pushed by andre.bargull@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/5518e046d03a
Part 1: Add "commonlyUsed" to Calendar and Collator. r=platform-i18n-reviewers,gregtatum
https://hg.mozilla.org/integration/autoland/rev/4fb2491acf41
Part 2: Add DateTimeFormat::GetAllowedHourCycles(). r=platform-i18n-reviewers,gregtatum
https://hg.mozilla.org/integration/autoland/rev/91c7f73689b3
Part 3: Add NumberingSystem class to the unified Intl API component. r=platform-i18n-reviewers,gregtatum
https://hg.mozilla.org/integration/autoland/rev/a56309fdebdd
Part 4: Switch intl_numberingSystem to use mozilla::intl::NumberingSystem. r=platform-i18n-reviewers,gregtatum
https://hg.mozilla.org/integration/autoland/rev/2478cae35f36
Part 5: Move time zone functions from mozilla::Calendar into mozilla::TimeZone. r=platform-i18n-reviewers,gregtatum
https://hg.mozilla.org/integration/autoland/rev/afb87d21b97b
Part 6: Rename GetDefaultTimeZoneOffsetMs() to GetRawOffsetMs(). r=platform-i18n-reviewers,gregtatum
https://hg.mozilla.org/integration/autoland/rev/3e6b7914038c
Part 7: Add method to enumerate over all time zones used in a region. r=platform-i18n-reviewers,gregtatum
https://hg.mozilla.org/integration/autoland/rev/5c5ea857c3d9
Part 8: Add a method to retrieve week day information to Calendar. r=platform-i18n-reviewers,gregtatum
Blocks: 1750781

The leave-open keyword is there and there is no activity for 6 months.
:sdetar, maybe it's time to close this bug?
For more information, please visit auto_nag documentation.

Flags: needinfo?(sdetar)

The spec for the proposal didn't progress in the last months.

Flags: needinfo?(sdetar)
You need to log in before you can comment on or make changes to this bug.