[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
date and localized outpout (was: German locale broken)
From: |
Pablo Saratxaga |
Subject: |
date and localized outpout (was: German locale broken) |
Date: |
Fri, 3 Aug 2001 13:43:12 +0200 |
Kaixo!
On Thu, Aug 02, 2001 at 07:13:22PM +0200, Stefan Siegel wrote:
> the german time format of the locales is broken:
> when I do date, this is what I get:
>
> +-------------------------------------------------
> |# date
> |Don Aug 2 18:39:30 CEST 2001
> +-------------------------------------------------
>
> As you can see it is the ugly backward foreward american mixery style.
> But "info date" says, that "date" should use the native style (%c):
date without parameters use that format, it is the same as:
date +"%a %b %e %H:%M:%S %Z %Y"
that allows parsing of the outpout in a previsible way.
If you want to format the output you need to format it yourself.
There are some special formaters like %c %x and %X for locale representations
of full date and time, abreviated date and times format.
> +---------------------------------------------------------------------
> | `date' with no arguments prints the current time and date, in the
> |format of the `%c' directive (described below).
the man page is wrong (note the English man page dated 2001 and coming with
sh-utils-2.0 doesn't have that phrase anymore, it is present on translations
of man(1) of a version of 1996 of the page)
> of the world! My locale (/usr/share/i18n/locales/de_DE) indicates the
> following:
>
> +---------------------------------------------------------------------
> |% Appropriate date and time representation (%c)
> |% "%a %d %b %Y %T %Z"
> |d_t_fmt
> |"<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025>
> |<U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
> +---------------------------------------------------------------------
>
> which would result in:
>
> +-------------------------------------------------
> |# date +"%a %d %b %Y %T %Z"
> |Don 02 Aug 2001 18:39:34 CEST
> +-------------------------------------------------
>
> much better, but should be:
>
> +-------------------------------------------------
> |# date +"%A, %d. %B %Y, %T (%Z)"
> |Donnerstag, 02. August 2001, 18:39:37 (CEST)
> +-------------------------------------------------
report that to Ulrich Drepper <address@hidden> if you think the
de_DE locale should be changed.
> as does a solaris system at our lab at university:
>
> +-------------------------------------------------
> |[SOLARIS]# date
> |Donnerstag, 2. August 2001, 18:40:57 Uhr MET DST
> +-------------------------------------------------
Mmh, can you look at the date documentation on solaris to see if
that behaviour (date = date %c) follows some known standard (like POSIX)
or not.
> A "strings /usr/share/locale/de_DE/LC_TIME" results in:
>
> +-------------------------------------------------
> |[...]
> |%a %b %e %H:%M:%S %Z %Y
> |[...]
> +-------------------------------------------------
>
> so this is why date gives the ugly american date format :-(
There are two different fields:
test:~/UUU/uni_vga# LC_ALL=de_DE locale -c date_fmt
LC_TIME
%a %b %e %H:%M:%S %Z %Y
test:~/UUU/uni_vga# LC_ALL=de_DE locale -c d_t_fmt
LC_TIME
%a %d %b %Y %T %Z
date %c uses field date_fmt.
Maybe date without parameters should use d_t_fmt ?
But it doesn't:
test:~/UUU/uni_vga# LC_ALL=ja locale -c d_t_fmt
LC_TIME
%Yǯ%m·î%dÆü %H»þ%Mʬ%SÉÃ
test:~/UUU/uni_vga# LC_ALL=ja date
¶â 8·î 3 13:39:50 CEST 2001
as you can see even when d_t_fmt is different it isn't used for date.
I don't know if this is a bug of 'date' or not
I cc to address@hidden so someone could give us some more
insight on this.
> BTW: At least french output also sucks:
it is the same for all, date without parameters seems to use
a fixed format of "%a %b %e %H:%M:%S %Z %Y" no matter what.
I don't know however if that is on purpose or not.
--
Ki ça vos våye bén,
Pablo Saratxaga
http://www.srtxg.easynet.be/ PGP Key available, key ID: 0x8F0E4975
- date and localized outpout (was: German locale broken),
Pablo Saratxaga <=