MenoData / Time4J

Advanced date, time and interval library for Java with sun/moon-astronomy and calendars like Chinese, Coptic, Ethiopian, French Republican, Hebrew, Hijri, Historic Christian, Indian National, Japanese, Julian, Korean, Minguo, Persian, Thai, Vietnamese
GNU Lesser General Public License v2.1
438 stars 64 forks source link

Respect Unicode extension `hc` #933

Closed s5bug closed 3 years ago

s5bug commented 3 years ago

As of right now I'm unable to override the clock system in a locale with hc like en-US-u-hc-h23 for 0-23 clock hours. If possible, I'd like to store this information in the language tab instead of as a separate variable. Is this possible?

MenoData commented 3 years ago

This feature is not yet offered by Time4J. I have found some documentation in CLDR.

If I understand you right then you would like to set the hc-preference in the locale and override any default time patterns in the format engine. This practically indicates the need to process/change format patterns created by default. For example, if the locale is "en-US-u-hc-h23" then the time-style-pattern needs to be changed from "hh:mm a" to "HH:mm" and vice versa. All style based formatters are concerned here.

Actually, the class ChronoFormatter supports following unicode extensions:

ca, nu, fw, rg (see the tutorial, too)

MenoData commented 3 years ago

Some kind of time style pattern processing is realized in the sister project Time4A where the default preference for 12/24-hour mode is evaluated. Maybe this code could be a start for the implementation in Time4J.