unicode-org / icu4x

Solving i18n for client-side and resource-constrained environments.
https://icu4x.unicode.org
Other
1.39k stars 178 forks source link

Historical calendar systems #5749

Open robertbastian opened 3 weeks ago

robertbastian commented 3 weeks ago

Currently we support resolving the correct calendar system for a locale. However, this is not data driven, but hardcoded: https://github.com/unicode-org/icu4x/blob/20c629a26c628a4e9e9915546b0d3a701a4789c0/components/calendar/src/any_calendar.rs#L1075-L1090

However, all locales started using their calendars at some point and often we do support the calendar they've used before that point as well (i.e. Julian). For en, for example, it should be possible to use ICU4X to render something akin to the cal tool

$ cal 9 1752
   September 1752     
Su Mo Tu We Th Fr Sa  
       1  2 14 15 16  
17 18 19 20 21 22 23  
24 25 26 27 28 29 30  

This uses the knowledge of when the en[^1] locale changed from the Julian calendar to the Gregorian calendar, which should be something ICU4X knows.

[^1]: Regions break down a bit if you go back that far, but incidentally every country that uses en today was part of the same country back then!