[Evolution-hackers] [PATCH v2 1/2] evolution: the language for the day of the week or month in quoted messages should match the message language



When quoting a message in a reply, make sure that the language for the
day of the week matches the language of the quoting text generated by
evolution.

Do the same for other similar strings such as the name of the month
(not being actively used in the application yet).

A bug is triggered, for example, when LC_MESSAGE is set to "C" (not
infrequent at all) and the other locale variables are set to the user
first language.

A patch is also required for the evolution-data-server code.

Signed-off-by: Guido Trentalancia <guido trentalancia net>
---
 mail/em-composer-utils.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff -pru evolution-3.20.1-orig/mail/em-composer-utils.c evolution-3.20.1/mail/em-composer-utils.c
--- evolution-3.20.1-orig/mail/em-composer-utils.c      2016-04-15 17:49:28.130259792 +0200
+++ evolution-3.20.1/mail/em-composer-utils.c   2016-04-15 18:13:44.810519195 +0200
@@ -2964,6 +2964,7 @@ enum {
        ATTRIB_CUSTOM,
        ATTRIB_TIMEZONE,
        ATTRIB_STRFTIME,
+       ATTRIB_STRFTIME_MATCH_LANG,
        ATTRIB_TM_SEC,
        ATTRIB_TM_MIN,
        ATTRIB_TM_24HOUR,
@@ -3017,10 +3018,10 @@ static struct {
        { "{Sender}", ATTRIB_CUSTOM, { NULL, format_sender } },
        { "{SenderName}", ATTRIB_CUSTOM, { NULL, format_sender } },
        { "{SenderEMail}", ATTRIB_CUSTOM, { NULL, format_sender } },
-       { "{AbbrevWeekdayName}", ATTRIB_STRFTIME, { "%a", NULL } },
-       { "{WeekdayName}", ATTRIB_STRFTIME, { "%A", NULL } },
-       { "{AbbrevMonthName}", ATTRIB_STRFTIME, { "%b", NULL } },
-       { "{MonthName}", ATTRIB_STRFTIME, { "%B", NULL } },
+       { "{AbbrevWeekdayName}", ATTRIB_STRFTIME_MATCH_LANG, { "%a", NULL } },
+       { "{WeekdayName}", ATTRIB_STRFTIME_MATCH_LANG, { "%A", NULL } },
+       { "{AbbrevMonthName}", ATTRIB_STRFTIME_MATCH_LANG, { "%b", NULL } },
+       { "{MonthName}", ATTRIB_STRFTIME_MATCH_LANG, { "%B", NULL } },
        { "{AmPmUpper}", ATTRIB_STRFTIME, { "%p", NULL } },
        { "{AmPmLower}", ATTRIB_STRFTIME, { "%P", NULL } },
        { "{Day}", ATTRIB_TM_MDAY, { "%02d", NULL } },  /* %d  01-31 */
@@ -3110,11 +3111,16 @@ attribution_format (CamelMimeMessage *me
                        g_string_append_printf (
                                str, attribvars[i].v.format, tzone);
                        break;
-               case ATTRIB_STRFTIME:
+                case ATTRIB_STRFTIME:
                        e_utf8_strftime (
                                buf, sizeof (buf), attribvars[i].v.format, &tm);
                        g_string_append (str, buf);
                        break;
+               case ATTRIB_STRFTIME_MATCH_LANG:
+                       e_utf8_strftime_matched_lang (
+                               buf, sizeof (buf), attribvars[i].v.format, &tm);
+                       g_string_append (str, buf);
+                       break;
                case ATTRIB_TM_SEC:
                        g_string_append_printf (
                                str, attribvars[i].v.format, tm.tm_sec);


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