Re: [evolution-patches] Show date in localtime.



On Tue, 2003-08-19 at 09:39 -0400, Not Zed wrote:
> Hi,
> 
> I've committed this to head, but with some slight changes.  I added
> translation for the day (it isn't required in camel because its an
> internet format string), and removed the tm_zone stuff, since it doesn't
> seem to add much and afaict not available many places (also since
> feature tests are confined to e-time-utils i didn't want the clutter).

How 'bout this... if we use e_utf8_strftime() we can dispense with the
duplicated array of day names altogether, and also get the time zone in
a portable and ifdef-free way...


Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2792
diff -u -p -r1.2792 ChangeLog
--- mail/ChangeLog	19 Aug 2003 14:14:29 -0000	1.2792
+++ mail/ChangeLog	20 Aug 2003 13:03:38 -0000
@@ -1,3 +1,10 @@
+2003-08-20  David Woodhouse  <dwmw2 infradead org>
+
+	* mail-format.c (write_date): Use e_utf8_strftime() to generate
+	localised time; avoid gratuitous extra translation and array of
+	day names, and the autoconf magic which made Not Zed dislike the
+	inclusion of the timezone name.
+
 2003-08-19  Not Zed  <NotZed Ximian com>
 
 	* mail-callbacks.c (mail_generate_reply): Added a comment for
Index: mail/mail-format.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-format.c,v
retrieving revision 1.293
diff -u -p -r1.293 mail-format.c
--- mail/mail-format.c	19 Aug 2003 13:58:22 -0000	1.293
+++ mail/mail-format.c	20 Aug 2003 13:03:39 -0000
@@ -775,11 +775,6 @@ write_field_row_begin (MailDisplayStream
 	}
 }
 
-/* day of the week names shown for remote mail offsets */
-static char *tz_days [] = {
-	N_("Sun"), N_("Mon"), N_("Tue"), N_("Wed"), N_("Thu"), N_("Fri"), N_("Sat")
-};
-
 static void
 write_date (MailDisplayStream *stream, CamelMimeMessage *message, int flags)
 {
@@ -806,15 +801,20 @@ write_date (MailDisplayStream *stream, C
 
 		if (msg_offset) {
 			/* Message timezone different from local. Show both */
-			camel_stream_printf((CamelStream *)stream,  "<I> (");
-			
+			char buf[30];
+
 			msg_offset += (local.tm_hour * 60) + local.tm_min;
+
 			if (msg_offset >= (24 * 60) || msg_offset < 0) {
 				/* Timezone conversion crossed midnight. Show day */
-				camel_stream_printf((CamelStream *)stream,  "%s, ",  _(tz_days[local.tm_wday]));
+				e_utf8_strftime(buf, 29, "<I> (%a, %R %Z)</I>", &local);
+			} else {
+				e_utf8_strftime(buf, 29, "<I> (%R %Z)</I>", &local);
 			}
-			/* translators: 'localtime' equivalent shown in date header for mails from other timezones */
-			camel_stream_printf((CamelStream *)stream, "%02d:%02d %s)</I>", local.tm_hour, local.tm_min, _("localtime"));
+
+			/* I doubt any locales put '%' in time representation
+			   but just in case... */
+			camel_stream_printf((CamelStream *)stream,  "%s", buf);
 		}
 					     
 		camel_stream_printf ((CamelStream *) stream, "</td> </tr>");



-- 
dwmw2




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