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
439 stars 64 forks source link

Introduce day periods with appropriate translations #369

Closed MenoData closed 8 years ago

MenoData commented 9 years ago

CLDR 28 has introduced a new concept for supporting day periods (including new pattern symbols "b" and "B"). See also:

http://cldr.unicode.org/development/development-process/design-proposals/day-period-design http://cldr.unicode.org/translation/date-time-names#TOC-Day-Periods-AM-and-PM-

Time4J might introduce a new class DayPeriod which can act as ChronoFunction<PlainTime,String> and offer options how to get the concrete time span and i18n-translation for a given time of day.

MenoData commented 9 years ago

Some notes:

MenoData commented 9 years ago

Note that the Ethiopian calendar (see #389) uses a special division of the day into day periods which is not offered by CLDR-data but should be taken into account here.

MenoData commented 8 years ago

Postponed to v3.12/4.9.

MenoData commented 8 years ago

A new method public Map<String, String> getTextForms() was added to class CalendarText in order to enable specialized access to dayperiod translations.

MenoData commented 8 years ago

Some preparations are done including i18n-resources, but again postponed to another release in order to release an important bugfix for HijriCalendar earlier.

MenoData commented 8 years ago

ICU seems to be willing to realize this feature, too but when? The realization was postponed several times, now scheduled to release 57.1. See also:

http://bugs.icu-project.org/trac/ticket/11872

MenoData commented 8 years ago

Starting with Zulu language, some ambivalent data (source CLDR) were detected which can defeat parsing of day periods in strict mode. This affects following languages: az, et, fa, he, hi, hu, mk, pt, si, tr, zh, zu (now corrected). It is a necessary requirement that translations of day period codes must be mappable in a unique way on codes and vice versa.

Needs more investigation and correction of data. About the correction of Zulu data, see issue #420

MenoData commented 8 years ago

About Chinese (zh): Some entries (下午 - in the afternoon) were mistaken instead of 中午 (noon),

MenoData commented 8 years ago

Although CLDR explicitly states that the fallback rules for dayperiods should be similar to AM/PM-rules, some data didn't follow those rules (using ABBREVIATED as fallback) but followed the standard rules (using WIDE-FORMAT or NARROW-STANDALONE as fallback). This has been corrected now for some languages (especially az, bs, et, he, mn).

Furthermore, the internal dayperiod element value is now allowed to carry more than one dayperiod code in order to allow ambivalent codes in first parse phase. If all parsed codes resolve to same and unambivalent am/pm-value in second phase then final time resolving can still be successful. This flexibility makes sense especially for parsing of NARROW dayperiod values.