w3c / ltli

Language Tags and Locale Identifiers for the World Wide Web
http://w3c.github.io/ltli/
6 stars 9 forks source link

thai buddhist calendar using the solar #23

Open himorin opened 3 years ago

himorin commented 3 years ago

In Example 1, th-u-ca-buddhist is used, but in contrast to the upper line, we might be better to mention about th-u-ca-buddhist-nu-thai (but not th-u-ca-buddhist-nu-latn =~ th-u-ca-buddhist) for the lunar but not the solar?

note: I'm actually not sure whether ca-buddhist should be mapped to the solar or the lunar by default.... (in ja, should be the lunar??)

aphillips commented 3 years ago

Thanks @himorin

The outputs shown here are from ICU/CLDR. The Thai Buddhist calendar is basically a Gregorian calendar with the year changed. This also describes the Japanese calendar.

ICU implements the Chinese and Dangi calendars as lunisolar (and obviously the Islamic calendar is lunar based). Since LTLI isn't about calendars per-se, I didn't really explore this topic in depth. Maybe more time should be spent on it.

For what it's worth, here's my code:

    private static void variousCalendarShenanigans() {
        String[] locales = { "th-u-ca-gregory", "th-u-ca-buddhist", "ja-u-ca-japanese",
                "ja-u-ca-gregory", "ja-u-ca-buddhist", "ar-u-ca-islamic", "en-u-ca-islamic", "en-u-ca-gregory"
        };
        for (String locale : locales) {
            ULocale uloc = ULocale.forLanguageTag(locale);
            DateFormat df = DateFormat.getPatternInstance("yyyyMMMd", uloc);
            System.out.println(String.format("%s: %s", locale, df.format(new Date())));
        }
    }

And here's the output:

International Components for Unicode for Java 67.1

Implementation Version: 67.1
Unicode Data Version:   13.0
CLDR Data Version:      37.0
Time Zone Data Version: 2019c
---

th-u-ca-gregory: 29 ก.ย. 2020
th-u-ca-buddhist: 29 ก.ย. 2563
ja-u-ca-japanese: 令和2年9月29日
ja-u-ca-gregory: 2020年9月29日
ja-u-ca-buddhist: 仏暦2563年9月29日
ar-u-ca-islamic: ١٢ صفر ١٤٤٢ هـ
en-u-ca-islamic: Saf. 12, 1442 AH
en-u-ca-gregory: Sep 29, 2020