diff options
-rw-r--r-- | mail/ChangeLog | 6 | ||||
-rw-r--r-- | mail/em-format-html.c | 38 |
2 files changed, 34 insertions, 10 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 4bf45fec17..38b2853ecd 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2008-01-08 Djihed Afifi <djihed@gmail.com> + + ** Fix for bug #309432 + + * em-format-html.c: Fix message headers for RTL languages. + 2008-01-08 Colin Leroy <colin@colino.net> ** Fix for bug #499145 diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 1339aa8ec0..c272fd6d78 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -1484,22 +1484,34 @@ efh_format_text_header (EMFormatHTML *emfh, CamelStream *stream, const char *lab else html = mhtml = camel_text_to_html (value, emfh->text_html_flags, 0); + gboolean is_rtl = gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL; if (emfh->simple_headers) { fmt = "<b>%s</b>: %s<br>"; } else { if (flags & EM_FORMAT_HTML_HEADER_NOCOLUMNS) { - if (flags & EM_FORMAT_HEADER_BOLD) + if (flags & EM_FORMAT_HEADER_BOLD) { fmt = "<tr><td><b>%s:</b> %s</td></tr>"; - else + } else { fmt = "<tr><td>%s: %s</td></tr>"; + } } else if (flags & EM_FORMAT_HTML_HEADER_NODEC) { - fmt = "<tr><th align=\"right\" valign=\"top\" nowrap>%s<b> </b></th><td valign=top>%s</td></tr>"; - } else { - - if (flags & EM_FORMAT_HEADER_BOLD) - fmt = "<tr><th align=\"right\" valign=\"top\" nowrap>%s:<b> </b></th><td>%s</td></tr>"; + if (is_rtl) + fmt = "<tr><td align=\"right\" valign=\"top\" width=\"100%%\">%2$s</td><th valign=top align=\"left\" nowrap>%1$s<b> </b></th></tr>"; else - fmt = "<tr><td align=\"right\" valign=\"top\" nowrap>%s:<b> </b></td><td>%s</td></tr>"; + fmt = "<tr><th align=\"right\" valign=\"top\" nowrap>%s<b> </b></th><td valign=top>%s</td></tr>"; + } else { + + if (flags & EM_FORMAT_HEADER_BOLD) { + if (is_rtl) + fmt = "<tr><td align=\"right\" valign=\"top\" width=\"100%%\">%2$s</td><th align=\"left\" nowrap>%1$s:<b> </b></th></tr>"; + else + fmt = "<tr><th align=\"right\" valign=\"top\" nowrap>%s:<b> </b></th><td>%s</td></tr>"; + } else { + if (is_rtl) + fmt = "<tr><td align=\"right\" valign=\"top\" width=\"100%\">%2$s</td><td align=\"left\" nowrap>%1$s:<b> </b></td></tr>"; + else + fmt = "<tr><td align=\"right\" valign=\"top\" nowrap>%s:<b> </b></td><td>%s</td></tr>"; + } } } @@ -1838,7 +1850,10 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) if (header_sender && header_from && mail_from_delegate) { camel_stream_printf(stream, "<tr><td><table border=1 width=\"100%%\" cellspacing=2 cellpadding=2><tr>"); - camel_stream_printf(stream, "<td align=\"left\" width=\"100%%\">"); + if(gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) + camel_stream_printf (stream, "<td align=\"right\" width=\"100%%\">"); + else + camel_stream_printf (stream, "<td align=\"left\" width=\"100%%\">"); /* To translators: This message suggests to the receipients that the sender of the mail is different from the one listed in From field. */ @@ -1853,7 +1868,10 @@ efh_format_headers(EMFormatHTML *efh, CamelStream *stream, CamelMedium *part) g_free (header_sender); g_free (header_from); - camel_stream_printf(stream, "<tr><td><table border=0 cellpadding=\"0\">\n"); + if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL) + camel_stream_printf (stream, "<tr><td><table width=\"100%%\" border=0 cellpadding=\"0\">\n"); + else + camel_stream_printf (stream, "<tr><td><table border=0 cellpadding=\"0\">\n"); /* dump selected headers */ h = (EMFormatHeader *)emf->header_list.head; |