[PATCH v2] localedata: Add Minguo calendar support to zh_TW

Rafal Luzynski digitalfreak@lingonborough.com
Sat Mar 2 15:49:00 GMT 2019


Felix,

Thank you for the update.  Please see the results of my tests.  First,
unpatched version:


$ LC_TIME=zh_TW.UTF-8 /usr/bin/date +%Ey
19
$ LC_TIME=zh_TW.UTF-8 /usr/bin/date +%EY
2019
$ LC_TIME=zh_TW.UTF-8 /usr/bin/date +%Ey -d 1992-01-01
92
$ LC_TIME=zh_TW.UTF-8 /usr/bin/date +%EY -d 1992-01-01
1992
$ LC_TIME=zh_TW.UTF-8 /usr/bin/date +%Ey -d 1913-01-01
13
$ LC_TIME=zh_TW.UTF-8 /usr/bin/date +%EY -d 1913-01-01
1913
$ LC_TIME=zh_TW.UTF-8 /usr/bin/date +%Ey -d 1912-12-31
12
$ LC_TIME=zh_TW.UTF-8 /usr/bin/date +%EY -d 1912-12-31
1912
$ LC_TIME=zh_TW.UTF-8 /usr/bin/date +%Ey -d 1912-01-01
12
$ LC_TIME=zh_TW.UTF-8 /usr/bin/date +%EY -d 1912-01-01
1912
$ LC_TIME=zh_TW.UTF-8 /usr/bin/date +%Ey -d 1911-12-31
11
$ LC_TIME=zh_TW.UTF-8 /usr/bin/date +%EY -d 1911-12-31
1911
$ LC_TIME=zh_TW.UTF-8 /usr/bin/date +%Ey -d 1901-12-31
01
$ LC_TIME=zh_TW.UTF-8 /usr/bin/date +%EY -d 1901-12-31
1901


Now the same commands with your patch applied:


$ LC_TIME=zh_TW.UTF-8 ./testrun.sh /usr/bin/date +%Ey
108
$ LC_TIME=zh_TW.UTF-8 ./testrun.sh /usr/bin/date +%EY
民國108年
$ LC_TIME=zh_TW.UTF-8 ./testrun.sh /usr/bin/date +%Ey -d 1992-01-01
81
$ LC_TIME=zh_TW.UTF-8 ./testrun.sh /usr/bin/date +%EY -d 1992-01-01
民國81年
$ LC_TIME=zh_TW.UTF-8 ./testrun.sh /usr/bin/date +%Ey -d 1913-01-01
02
$ LC_TIME=zh_TW.UTF-8 ./testrun.sh /usr/bin/date +%EY -d 1913-01-01
民國02年
$ LC_TIME=zh_TW.UTF-8 ./testrun.sh /usr/bin/date +%Ey -d 1912-12-31
01
$ LC_TIME=zh_TW.UTF-8 ./testrun.sh /usr/bin/date +%EY -d 1912-12-31
民國元年
$ LC_TIME=zh_TW.UTF-8 ./testrun.sh /usr/bin/date +%Ey -d 1912-01-01
01
$ LC_TIME=zh_TW.UTF-8 ./testrun.sh /usr/bin/date +%EY -d 1912-01-01
民國元年
$ LC_TIME=zh_TW.UTF-8 ./testrun.sh /usr/bin/date +%Ey -d 1911-12-31
01
$ LC_TIME=zh_TW.UTF-8 ./testrun.sh /usr/bin/date +%EY -d 1911-12-31
民前01年
$ LC_TIME=zh_TW.UTF-8 ./testrun.sh /usr/bin/date +%Ey -d 1901-12-31
11
$ LC_TIME=zh_TW.UTF-8 ./testrun.sh /usr/bin/date +%EY -d 1901-12-31
民前11年


Please confirm this is what you wanted to achieve.  Being unable to
read Chinese script I can only verify the numbers and I can only
trust you that this is correct otherwise.

Now please look inside the localedata/locales directory. [1] There
are 5 other locales from Taiwan: cmn_TW, hak_TW, lzh_TW, nan_TW,
and nan_TW@latin.  If Minguo calendar is popular in Taiwan then do
you think that those other locales need the same update as well?
Can you please update them, and maybe squash all changes into a single
patch?

Also please see below:

1.03.2019 20:27 Felix Yan <felixonmars@archlinux.org> wrote:
> 
> Minguo calendar is the official calendar system, and very widely used in
> Taiwan, it would be nice to have the support in glibc.
> 
> Some background information: The government website (www.gov.tw) uses it
> without the prefix, popular public services like Taiwan HSR also uses
> this calendar system.

I don't understand what is the prefix ("without the prefix") here.
Is this a typo or maybe just a concept I am not familiar with?

> Link to wikipedia: https://en.wikipedia.org/wiki/Minguo_calendar
> ---
>  localedata/locales/zh_TW | 4 ++++
>  1 file changed, 4 insertions(+)

ChangeLog entry is missing here.  I don't mean updating ChangeLog and
posting the diff here but a short summary of changes should be included
in the commit message, e.g.:

        [BZ #...]
        * localedata/locales/zh_TW (LC_TIME): Add era, support Minguo
        calendar.

or 

        [BZ #...]
        * localedata/locales/zh_TW (era): Add, support Minguo calendar.

I've just realized that Bugzilla entry is missing for this issue, please
file it. [2] (Select Component: localedata).  Also add the bug number
to the first line of the commit message which is also the subject line
of this email.

> diff --git a/localedata/locales/zh_TW b/localedata/locales/zh_TW
> index 92b04b083d..b869dec317 100644
> --- a/localedata/locales/zh_TW
> +++ b/localedata/locales/zh_TW
> @@ -126,6 +126,10 @@ am_pm	"<U4E0A><U5348>";"<U4E0B><U5348>"
>  % t_fmt_ampm: "%p %I<h>%M<m>%S<s>"
>  t_fmt_ampm  "%p %I<U6642>%M<U5206>%S<U79D2>"
>  week 7;19971130;1
> +
> +era "+:2:1913//01//01:+*:<U6C11><U570B>:%EC%Ey<U5E74>";/
> +    "+:1:1912//01//01:1912//12//31:<U6C11><U570B>:%EC<U5143><U5E74>";/
> +    "+:1:1911//12//31:-*:<U6C11><U524D>:%EC%Ey<U5E74>"
>  END LC_TIME
>  
>  LC_MESSAGES
> -- 
> 2.21.0

I believe this is correct, see my tests above.

Regards,

Rafal


[1]
https://sourceware.org/git/?p=glibc.git;a=tree;f=localedata/locales;hb=HEAD
[2] https://sourceware.org/bugzilla/enter_bug.cgi?product=glibc



More information about the Libc-alpha mailing list