From 21069fb83d54357dcc0da3b25662edbc05becc4f Mon Sep 17 00:00:00 2001 From: Patrick Winnertz Date: Fri, 14 Aug 2009 19:03:00 +0200 Subject: [PATCH 1/2] Ticket #1533: Fix the date issue on german locale. Use a #define for consistent translation of the date through whole util.c Signed-off-by: Patrick Winnertz --- src/util.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/util.c b/src/util.c index 213a28674..7ff66b8af 100644 --- a/src/util.c +++ b/src/util.c @@ -58,6 +58,12 @@ #include "charsets.h" #endif +/*In order to use everywhere the same setup + for the locale we use defines */ +#define FMTYEAR _("%b %e %Y") +#define FMTTIME _("%b %e %H:%M") + + int easy_patterns = 1; extern void str_replace(char *s, char from, char to) @@ -623,9 +629,9 @@ i18n_checktimelength (void) char buf [MB_LEN_MAX * MAX_I18NTIMELENGTH + 1]; size_t a, b; - strftime (buf, sizeof(buf) - 1, _("%b %d %H:%M"), lt); + strftime (buf, sizeof(buf) - 1, FMTTIME, lt); a = str_term_width1 (buf); - strftime (buf, sizeof(buf) - 1, _("%b %d %Y"), lt); + strftime (buf, sizeof(buf) - 1, FMTYEAR, lt); b = str_term_width1 (buf); length = max (a, b); @@ -648,14 +654,6 @@ file_date (time_t when) static const char *fmtyear, *fmttime; const char *fmt; - if (!i18n){ - /* strftime() format string for old dates */ - fmtyear = _("%b %e %Y"); - /* strftime() format string for recent dates */ - fmttime = _("%b %e %H:%M"); - i18n = 1; - } - if (current_time > when + 6L * 30L * 24L * 60L * 60L /* Old. */ || current_time < when - 60L * 60L) /* In the future. */ /* The file is fairly old or in the future. @@ -665,9 +663,9 @@ file_date (time_t when) to allow for NFS server/client clock disagreement. Show the year instead of the time of day. */ - fmt = fmtyear; + fmt = FMTYEAR; else - fmt = fmttime; + fmt = FMTTIME; FMT_LOCALTIME(timebuf, sizeof (timebuf), fmt, when); From 1baf186c16d75125d0f9605a77a4b180f99d9752 Mon Sep 17 00:00:00 2001 From: Patrick Winnertz Date: Fri, 14 Aug 2009 19:18:08 +0200 Subject: [PATCH 2/2] Removed three unneeded variables Signed-off-by: Patrick Winnertz --- src/util.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/util.c b/src/util.c index 7ff66b8af..264918258 100644 --- a/src/util.c +++ b/src/util.c @@ -650,8 +650,6 @@ file_date (time_t when) { static char timebuf [MB_LEN_MAX * MAX_I18NTIMELENGTH + 1]; time_t current_time = time ((time_t) 0); - static int i18n = 0; - static const char *fmtyear, *fmttime; const char *fmt; if (current_time > when + 6L * 30L * 24L * 60L * 60L /* Old. */