(Resent the patch attached because I've got no-mime advise...)
Hi GNU sh-utils maintainers,
I have wondered why the date format of date command in sh-utils is broken in
Japanese locale for a long time and got a chance to see and fix the code today.
1. HAVE_LANGINFO_H is not defined in config.h, so date.c skips to include
langinfo.h.
DATE_FMT_LANGINFO() returns NULL, so Japanese locale date format will be
automatically ignored. You should see HAVE_LANGINFO_CODESET as defined in config.h.
2. You warn so that people don't wrap date format string to be gettextized with _(),
but dcgettext() function will help this with LC_TIME specified. GNU file-utils(ls.c)
also uses this dcgettext().
Could you commit my change attached until next release of sh-utils?
Thank you.
--
Yukihiro Nakai, Red Hat Japan, Development
--- sh-utils-2.0.12/src/date.c.orig 2002-09-08 21:19:26.000000000 +0900
+++ sh-utils-2.0.12/src/date.c 2002-09-08 21:23:21.000000000 +0900
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>
-#if HAVE_LANGINFO_H
+#if HAVE_LANGINFO_CODESET
# include <langinfo.h>
#endif
@@ -509,14 +509,7 @@
else
{
char *date_fmt = DATE_FMT_LANGINFO ();
- /* 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. */
- format = *date_fmt ? date_fmt : "%a %b %e %H:%M:%S %Z %Y";
+ format = *date_fmt ? date_fmt : dcgettext(NULL, N_("%a %b %e %H:%M:%S %Z
+%Y"), LC_TIME);
}
}
else if (*format == '\0')
--- sh-utils-2.0.12/ChangeLog.orig 2002-09-08 21:23:54.000000000 +0900
+++ sh-utils-2.0.12/ChangeLog 2002-09-08 21:25:37.000000000 +0900
@@ -1,3 +1,8 @@
+2002-09-08 Yukihiro Nakai <[EMAIL PROTECTED]>
+
+ * date.c: Use HAVE_LANGINFO_CODESET defined in config.h
+ * date.c: Use dcgettext to let LC_TIME value change date format
+
2002-04-29 Jim Meyering <[EMAIL PROTECTED]>
* Version 2.0.12.
_______________________________________________
Bug-sh-utils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-sh-utils