unicode-org / icu4x

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

Support numeric overrides in DateTimeFormat #4242

Open Manishearth opened 12 months ago

Manishearth commented 12 months ago

Split out of https://github.com/unicode-org/icu4x/issues/3865

https://github.com/unicode-org/icu4x/pull/4228 adds support for numeric overrides in patterns.

We need to teach DateTimeFormat to apply these.

Manishearth commented 12 months ago

Currently the only overrides available are d=hanidays, hanidec, hebr, M=romanlow, y=jpanyear. Out of these , the M and d ones can be hardcoded as a symbols array (though it may be better to write a short hanidays algorithm that supports numbers <100). y=jpanyear is quite straightforward: it simply uses for y=1. hanidec is a very straightforward symbol based scheme (could be done using FixedDecimalFormat, but easy enough to hardcode in a compact way).

hebr is the only real challenge (it's complicated). We can punt on this for now and use Latin until we support full RBNF, and then invoke that.