From fee1a9752eabf8f5fc08b952adf3255415dea241 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Tue, 19 Aug 2003 13:58:22 +0000 Subject: Added translation for day and localtime strings. Also removed the tz_zone 2003-08-19 Not Zed * mail-format.c (write_date): Added translation for day and localtime strings. Also removed the tz_zone stuff, and just use 'localtime' always. 2003-08-15 David Woodhouse * mail-format.c (write_date): Show date in localtime too. svn path=/trunk/; revision=22283 --- mail/ChangeLog | 10 ++++++++++ mail/mail-format.c | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 215864ed77..69d9f59aef 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,13 @@ +2003-08-19 Not Zed + + * mail-format.c (write_date): Added translation for day and + localtime strings. Also removed the tz_zone stuff, and just use + 'localtime' always. + +2003-08-15 David Woodhouse + + * mail-format.c (write_date): Show date in localtime too. + 2003-08-19 Harry Lu ** For #45348 diff --git a/mail/mail-format.c b/mail/mail-format.c index b77f9316b1..85f91d0d80 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -48,6 +48,7 @@ #include #include +#include #include "mail.h" #include "mail-tools.h" @@ -774,6 +775,11 @@ write_field_row_begin (MailDisplayStream *stream, const char *name, int flags) } } +/* 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) { @@ -782,8 +788,36 @@ write_date (MailDisplayStream *stream, CamelMimeMessage *message, int flags) datestr = camel_medium_get_header (CAMEL_MEDIUM (message), "Date"); if (datestr) { - write_field_row_begin (stream, _("Date"), flags); - camel_stream_printf ((CamelStream *) stream, "%s ", datestr); + int msg_offset; + time_t msg_date; + struct tm local; + int local_tz; + + msg_date = header_decode_date(datestr, &msg_offset); + e_localtime_with_offset(msg_date, &local, &local_tz); + + write_field_row_begin(stream, _("Date"), flags); + camel_stream_printf((CamelStream *)stream, "%s", datestr); + + /* Convert message offset to minutes (e.g. -0400 --> -240) */ + msg_offset = ((msg_offset / 100) * 60) + (msg_offset % 100); + /* Turn into offset from localtime, not UTC */ + msg_offset -= local_tz / 60; + + if (msg_offset) { + /* Message timezone different from local. Show both */ + camel_stream_printf((CamelStream *)stream, " ("); + + 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])); + } + /* translators: 'localtime' equivalent shown in date header for mails from other timezones */ + camel_stream_printf((CamelStream *)stream, "%02d:%02d %s)", local.tm_hour, local.tm_min, _("localtime")); + } + + camel_stream_printf ((CamelStream *) stream, " "); } } -- cgit v1.2.3