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

Mismatch between ICU4X and ECMA402 for package:intl4x #792

Open
mosuem opened this issue Feb 6, 2024 · 4 comments
Open

Mismatch between ICU4X and ECMA402 for package:intl4x #792

mosuem opened this issue Feb 6, 2024 · 4 comments
Labels
package:intl4x type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@mosuem
Copy link
Member

mosuem commented Feb 6, 2024

This issue is for collecting mismatches between ICU4X and ECMA402.

cc @robertbastian @sffc @Manishearth

Datetime

Defaults:

Intl(locale: const Locale(language: 'en', region: 'US'))
              .datetimeFormat()
              .format(DateTime.utc(2012, 12, 20, 3, 0, 0))

prints 12/20/2012 - this doesn't correspond to any DateLength for ICU4X.

Timezones:

Intl(locale: const Locale(language: 'en', region: 'US'))
            .datetimeFormat(DateTimeFormatOptions(
              timeZone: 'America/Los_Angeles',
              timeZoneName: TimeZoneName.long,
            ))
            .format(date)

prints 12/16/2021, Pacific Standard Time - formatting a date with a timezone is not possible in ICU4X.

More complex patterns:

Intl(locale: const Locale(language: 'fr'))
              .datetimeFormat(const DateTimeFormatOptions(
                hour: TimeStyle.numeric,
                clockstyle: ClockStyle(
                  is12Hour: true,
                  startAtZero: false,
                ),
                dayPeriod: DayPeriod.long,
                timeZone: 'UTC',
              ))
              .format(date)

prints 4 du matin - formatting complex patterns in not possible in ICU4X.

Calendar:

islamic has no direct corresponding entry in AnyCalendarKind.

Number formatting

Dart needs some logic to map the API settings to each other, due to the very different APIs between ICU4X and ECMA402. See

icu.FixedDecimal _constructDouble(icu.FixedDecimal fixedDecimal) {
.
Also missing some functionality such as percentage, scientific, or unit formatting, see unicode-org/icu4x#275.

Plural rules

Only ordinal, cardinal supported, but no number formatting options, see also tc39/ecma402#365.

Display names

Missing support for DateTime, Calendar, Currency, and Script display.

Also, for display names of languages, zh-Hant seems to resolve to zh_Hant-long for ICU4X, but not ECMA, see https://st.unicode.org/cldr-apps/v#/en/Languages_A_D/32a57b96452f2198 and https://github.com/dart-lang/i18n/actions/runs/7888128898/job/21524894392?pr=800.

@mosuem mosuem added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) package:intl4x labels Feb 6, 2024
@Manishearth
Copy link

@sffc you're the most up to date on ECMA402 coverage: do you know if we have issues for most of these? Are any of these unexpected (they seem to be known gaps)

@sffc
Copy link

sffc commented Feb 9, 2024

These are mostly the set of known ECMA-402 compat issues and they are mostly resourced. See the master spreadsheet:

https://docs.google.com/spreadsheets/d/1rdH5_LqiMvFJM9pj3AEFigeCYdH9Y2Lpw7-MJ23T73A/edit#gid=0

One thing:

islamic has no direct corresponding entry in AnyCalendarKind.

We support all 4 flavors of islamic calendar. -u-ca-islamic corresponds to AnyCalendarKind::IslamicObservational.

@robertbastian
Copy link
Collaborator

-u-ca-islamic corresponds to AnyCalendarKind::IslamicObservational

We should document this better.

There are 5 islamic calendars in CLDR: https://github.com/unicode-org/cldr/blob/main/common/bcp47/calendar.xml#L22-L26. The names don't match up directly, which one is missing?

@Manishearth
Copy link

RGSA, which is is also missing in ICU but ICU lies about it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:intl4x type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants