[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#160282: cal: Should use the latter Chinese char for day of the week (fwd)



感謝各位的努力..

lloyd@gentoo tmp # cal -V
cal from util-linux-2.11y
lloyd@gentoo tmp # cal
     十二月 2002
日 一 二 三 四 五 六
 1  2  3  4  5  6  7
 8  9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31

lloyd@gentoo tmp # date
二 12月 24 13:07:10 CST 2002
lloyd@gentoo tmp # ls /lib/libc.so.6 -l
lrwxrwxrwx    1 root     root           13 2002-12-16 05:03 /lib/libc.so.6 -> libc-2.3.1.so

Gentoo 1.4
一 1
二 1
三 1
四 1
五 1
六 1
日 1
週一 2
週二 2
週三 2
週四 2
週五 2
週六 2
週日 2

On Wed, 18 Sep 2002, Pofeng Lee wrote:
>
> 請問有人知道 FreeBSD 的 locale data 是誰維護的嗎 ?
> ( maybe also IBM ICU shound be taken into consideration )
>
> PS. 我是贊成修改 glibc 的 LC_TIME 的 abday 啦 :p
>
> ---------- Forwarded message ----------
> Date: Tue, 17 Sep 2002 11:03:15 +0800 (CST)
> From: lloyd <lloyd@coventive.com>
> To: debian-chinese-big5@lists.debian.org
> Subject: Re: Bug#160282: cal: Should use the latter Chinese char for day of
>     the week
> Resent-Date: Mon, 16 Sep 2002 22:03:24 -0500 (CDT)
> Resent-From: debian-chinese-big5@lists.debian.org
>
> 我是不知道為什麼 debian 使用的是 bsdutils ..
> 但總是會有 debian 採用的理由.
>
> 我認為 cal 問題出在 strftime 也就是 LC_CTIME 的回傅值。
> 這一段程式在 linux 與 freebsd 上有不同的表現。
>
> #include <time.h>
> #include <locale.h>
>
> int main ()
> {
>    int i,len;
>    struct tm tm;
>    char buf[20];
>
>    setlocale(LC_ALL,"");
>    memset(&tm, 0, sizeof(tm));
>
>    for (i = 0; i != 7; i++)
>      {
> 	tm.tm_wday = (i+1) % 7;
> 	strftime(buf, sizeof(buf), "%a", &tm);
> 	len = mbstowcs(NULL, buf, 0);
> 	printf ("%s %d\n",buf,len);
>      }
>
>    for (i = 0; i != 7; i++)
>      {
> 	tm.tm_wday = (i+1) % 7;
> 	strftime(buf, sizeof(buf), "%A", &tm);
> 	len = mbstowcs(NULL, buf, 0);
> 	printf ("%s %d\n",buf,len);
>      }
> }
>
> debian woody  	freebsd 4.6
> 週一 2	        一 -1
> 週二 2	        二 -1
> 週三 2	        三 -1
> 週四 2	        四 -1
> 週五 2	        五 -1
> 週六 2	        六 -1
> 週日 2      	日 -1
> 星期一 3    	周一 -1
> 星期二 3    	周二 -1
> 星期三 3    	周三 -1
> 星期四 3    	周四 -1
> 星期五 3    	周五 -1
> 星期六 3    	周六 -1
> 星期日 3    	周日 -1
>
> debian 的 ncal 來自 bsd ,
> bsd 的是
>       9月 2002
> 日 一 二 三 四 五 六
>  1  2  3  4  5  6  7
>  8  9 10 11 12 13 14
> 15 16 17 18 19 20 21
> 22 23 24 25 26 27 28
> 29 30
>
> 而 linux 最多最多也只能改成
>       九月 2002
> 週日 週一 週二 週三 週四 週五 週六
>  1  2  3  4  5  6  7
>  8  9 10 11 12 13 14
> 15 16 17 18 19 20 21
> 22 23 24 25 26 27 28
> 29 30
>
> 因為我們不知道這是否會引響到別的同是雙位元語系國家, 除非是去修正我們自己的 LC_CTIME
> 讓它的 strftime(buf, sizeof(buf), "%a", &tm); 為
> 日 一 二 三 四 五 六
> 而 strftime(buf, sizeof(buf), "%A", &tm); 為
> 週日 週一 週二 週三 週四 週五 週六
>
> 但這樣作下去又一定會去引響到其它程式
> 所以最好加上一段 sed 程式, 將 週 這個字濾掉.
>
>
> 有這方面須求的人可以取回 util-linux
> http://www.kernel.org/pub/linux/utils/util-linux/ 改用  util-linux 的 cal
> 或是採用 加上 Rex Tsai 幫忙的 Patch 來修正這個問題。
>
> 為了畫面的美觀加一段 sed 程式 取名為 zh-cal 放到 /usr/local/bin 下
> #!/bin/bash
> cal %@ | sed 's/週//d'
>

--
    ◢◣
□□□ ██ □□□□
□  ◢█□     造形.空間.秩序.?□  ███◣      主從.對比.韻律?□ ▅████▅      lloyd@coventive.com    □
□□███████▆▆▃▃□ Coventive Technologies Ltd □



Reply to: