[evolution] Bug 788479 - Translated reply prefixes not detected



commit b43f98751fad7f6666e2d5aebde1c396e7c2694b
Author: Milan Crha <mcrha redhat com>
Date:   Wed Oct 4 10:35:18 2017 +0200

    Bug 788479 - Translated reply prefixes not detected

 src/mail/em-composer-utils.c |    4 ++--
 src/mail/em-utils.c          |   28 ++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/src/mail/em-composer-utils.c b/src/mail/em-composer-utils.c
index 5ba5f53..e92f74e 100644
--- a/src/mail/em-composer-utils.c
+++ b/src/mail/em-composer-utils.c
@@ -2558,8 +2558,8 @@ reply_setup_composer (EMsgComposer *composer,
                if (em_utils_is_re_in_subject (subject, &skip_len, NULL, NULL) && skip_len > 0)
                        subject = subject + skip_len;
 
-               /* Translators: This is a reply attribution in the message reply subject. The %s is replaced 
with the subject of the original message. */
-               subject = g_strdup_printf (_("Re: %s"), subject);
+               /* Translators: This is a reply attribution in the message reply subject. The %s is replaced 
with the subject of the original message. Both 'Re'-s in the 'reply-attribution' translation context should 
translate into the same string, the same as the ':' separator. */
+               subject = g_strdup_printf (C_("reply-attribution", "Re: %s"), subject);
        } else {
                subject = g_strdup ("");
        }
diff --git a/src/mail/em-utils.c b/src/mail/em-utils.c
index 3c37e43..0d6edb4 100644
--- a/src/mail/em-utils.c
+++ b/src/mail/em-utils.c
@@ -1465,6 +1465,7 @@ em_utils_is_re_in_subject (const gchar *subject,
 {
        gchar **prefixes_strv;
        gchar **separators_strv;
+       const gchar *localized_re, *localized_separator;
        gboolean res;
        gint ii;
 
@@ -1498,6 +1499,33 @@ em_utils_is_re_in_subject (const gchar *subject,
                return TRUE;
        }
 
+       /* Translators: This is a reply attribution in the message reply subject. Both 'Re'-s in the 
'reply-attribution' translation context should translate into the same string. */
+       localized_re = C_("reply-attribution", "Re");
+
+       /* Translators: This is a reply attribution separator in the message reply subject. This should match 
the ':' in 'Re: %s' in the 'reply-attribution' translation context. */
+       localized_separator = C_("reply-attribution", ":");
+
+       if (check_prefix (subject, localized_re, (const gchar * const *) separators_strv, skip_len)) {
+               if (!use_separators_strv)
+                       g_strfreev (separators_strv);
+
+               return TRUE;
+       }
+
+       if (localized_separator && g_strcmp0 (localized_separator, ":") != 0) {
+               const gchar *localized_separator_strv[2];
+
+               localized_separator_strv[0] = localized_separator;
+               localized_separator_strv[1] = NULL;
+
+               if (check_prefix (subject, localized_re, (const gchar * const *) localized_separator_strv, 
skip_len)) {
+                       if (!use_separators_strv)
+                               g_strfreev (separators_strv);
+
+                       return TRUE;
+               }
+       }
+
        if (use_prefixes_strv) {
                prefixes_strv = (gchar **) use_prefixes_strv;
        } else {


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