Hi,
On http://www.opengroup.org/onlinepubs/000095399/utilities/date.html
it says under the examples:
$ LANG=da_DK.iso_8859-1 date
ons 02 okt 1991 15:03:32 CET
But when coreutils' current date is used (with LC_TIME and LC_ALL
unset):
$ LANG=da_DK.utf8 src/date
søn aug 31 13:21:21 CEST 2008
The day and month are reversed and the year is at the end instead of
after the month. For Dutch the same misformat is used: an American
format with only the abbreviations translated to Dutch.
date uses 'nl_langinfo (_DATE_FMT)', but the manpage for nl_langinfo
does not mention _DATE_FMT; it only lists D_T_FMT, D_FMT and T_FMT.
After applying the attached first patch (changing _DATE_FMT to
D_T_FMT) things are correct (using libc-2.7):
$ LANG=da_DK.utf8 date
søn 31 aug 2008 13:24:32 CEST
The second patch removes a comment that seems mistaken, because it
doesn't take into account that LC_TIME could be for example da_DK.
Alternatively, it could let translators specify a fallback format
by doing something like this:
setlocale (LC_MESSAGES, getlocale (LC_TIME));
format = _("%a %b %e %H:%M:%S %Z %Y");
setlocale (LC_ALL, "");
Benno
From 5e17acc09261e16e747c58583510d66549185c5a Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <[EMAIL PROTECTED]>
Date: Sun, 31 Aug 2008 13:09:52 +0200
Subject: [PATCH] date: call nl_langinfo with proper argument
---
src/date.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/date.c b/src/date.c
index 3cfcc62..4e84a5f 100644
--- a/src/date.c
+++ b/src/date.c
@@ -109,8 +109,8 @@ static struct option const long_options[] =
# define TZSET /* empty */
#endif
-#ifdef _DATE_FMT
-# define DATE_FMT_LANGINFO() nl_langinfo (_DATE_FMT)
+#ifdef D_T_FMT
+# define DATE_FMT_LANGINFO() nl_langinfo (D_T_FMT)
#else
# define DATE_FMT_LANGINFO() ""
#endif
--
1.5.6.4
From 46bff8f13ff524fcdfc8d969b8a739b70405f44f Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <[EMAIL PROTECTED]>
Date: Sun, 31 Aug 2008 13:34:06 +0200
Subject: [PATCH] date: correct a non-localization comment
---
src/date.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/date.c b/src/date.c
index 4e84a5f..2eccef0 100644
--- a/src/date.c
+++ b/src/date.c
@@ -451,13 +451,8 @@ main (int argc, char **argv)
format = DATE_FMT_LANGINFO ();
if (! *format)
{
- /* Do not wrap the following literal format string with _(...).
- For example, suppose LC_ALL is unset, LC_TIME="POSIX",
- and LANG="ko_KR". In that case, POSIX says that LC_TIME
- determines the format and contents of date and time strings
- written by date, which means "date" must generate output
- using the POSIX locale; but adding _() would cause "date"
- to use a Korean translation of the format. */
+ /* Do not wrap the following literal format string with _(); it
+ is a fallback format for when localization isn't working. */
format = "%a %b %e %H:%M:%S %Z %Y";
}
}
--
1.5.6.4
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils