icu4x icon indicating copy to clipboard operation
icu4x copied to clipboard

AnyDateTimeFormat should fallback calendars by locale

Open Manishearth opened this issue 2 years ago • 3 comments

Blocked on https://github.com/unicode-org/icu4x/issues/1109

https://github.com/unicode-org/icu4x/pull/1987 adds formatting for AnyCalendar, however it unconditionally falls back to the Gregorian calendar. We should instead be getting this fallbacking from data, ideally using vertical fallback (but we can just have a calendars/default@1 key if we really have to).

Filing a separate issue so it can be a polish blocker.

Manishearth avatar Jun 10 '22 17:06 Manishearth

The regions using non-Gregorian default are:

  • AF, IR (persian)
  • SA (islamic-umalqura)
  • TH (buddhist)

Source: https://github.com/unicode-org/cldr/blob/b2b36963947b0e3e172fa40519d13afd9877a227/common/supplemental/supplementalData.xml#L4715

Of those, the only one we support right now is Buddhist. So to fix the 1.0 issue, we can hard-code a check for TH. Given that Thai is one of our testdata languages, this would also be a nice test to add to demonstrate the i18n of DateTimeFormatter.

sffc avatar Jul 24 '22 06:07 sffc

Created #2236 for the longer-term solution to this problem.

sffc avatar Jul 24 '22 06:07 sffc

Related: https://github.com/unicode-org/icu4x/issues/2357

Manishearth avatar Aug 09 '22 22:08 Manishearth