[evolution] Bug 788916 - Localized "Fwd:"/"Re:" can't be disabled



commit c5ca2d356f6e75803fa143891d6e401d116b4ff3
Author: Milan Crha <mcrha redhat com>
Date:   Fri Oct 13 11:43:36 2017 +0200

    Bug 788916 - Localized "Fwd:"/"Re:" can't be disabled

 data/org.gnome.evolution.mail.gschema.xml.in |    5 +++
 src/libemail-engine/mail-tools.c             |   16 ++++++++-
 src/mail/em-composer-utils.c                 |   12 ++++++-
 src/mail/mail-config.ui                      |   45 ++++++++++++++++++--------
 src/modules/mail/em-composer-prefs.c         |    6 +++
 5 files changed, 66 insertions(+), 18 deletions(-)
---
diff --git a/data/org.gnome.evolution.mail.gschema.xml.in b/data/org.gnome.evolution.mail.gschema.xml.in
index 4f70367..897c264 100644
--- a/data/org.gnome.evolution.mail.gschema.xml.in
+++ b/data/org.gnome.evolution.mail.gschema.xml.in
@@ -190,6 +190,11 @@
       <_summary>List of localized “Re” separators</_summary>
       <_description>A list of localized “Re” separators, used to skip in a subject text when replying to a 
message, as an addition to the standard “:” and the Unicode “︰” separators.</_description>
     </key>
+    <key name="composer-use-localized-fwd-re" type="b">
+      <default>false</default>
+      <_summary>Use localized “Fwd”/“Re” in message Subject</_summary>
+      <_description>When set to true, uses localized “Fwd”/“Re” in message Subject on reply and forward as 
provided by current locale translation, otherwise uses unlocalized version.</_description>
+    </key>
     <key name="composer-word-wrap-length" type="i">
       <default>71</default>
       <_summary>Number of characters for wrapping</_summary>
diff --git a/src/libemail-engine/mail-tools.c b/src/libemail-engine/mail-tools.c
index fb8ac11..0b4a87b 100644
--- a/src/libemail-engine/mail-tools.c
+++ b/src/libemail-engine/mail-tools.c
@@ -34,6 +34,7 @@
 
 #include <glib/gi18n.h>
 
+#include "e-util/e-util.h"
 #include "e-mail-session.h"
 #include "mail-folder-cache.h"
 #include "mail-tools.h"
@@ -155,6 +156,8 @@ mail_tool_generate_forward_subject (CamelMimeMessage *msg)
        gchar *subject = NULL;
        gchar *fwd_subj;
        const gint max_subject_length = 1024;
+       const gchar *format;
+       GSettings *settings;
 
        orig_subject = camel_mime_message_get_subject (msg);
 
@@ -189,8 +192,17 @@ mail_tool_generate_forward_subject (CamelMimeMessage *msg)
                        subject = camel_address_format (CAMEL_ADDRESS (from));
        }
 
-       /* Translators: This is a subject attribution for forwarded messages. The %s is replaced with subject 
of the original message. */
-       fwd_subj = g_strdup_printf (_("[Fwd: %s]"),
+       settings = e_util_ref_settings ("org.gnome.evolution.mail");
+       if (g_settings_get_boolean (settings, "composer-use-localized-fwd-re")) {
+               /* Translators: This is a subject attribution for forwarded messages. The %s is replaced with 
subject of the original message. */
+               format = _("[Fwd: %s]");
+       } else {
+               /* Do not localize this string */
+               format = "[Fwd: %s]";
+       }
+       g_clear_object (&settings);
+
+       fwd_subj = g_strdup_printf (format,
                /* Translators: This is a subject attribution for forwarded messages, used when there could 
not be used any subject.
                   It results in "[Fwd: No Subject]" being used as a subject of the forwarded message. */
                (subject && *subject) ? subject : _("No Subject"));
diff --git a/src/mail/em-composer-utils.c b/src/mail/em-composer-utils.c
index e92f74e..d48eb55 100644
--- a/src/mail/em-composer-utils.c
+++ b/src/mail/em-composer-utils.c
@@ -2553,13 +2553,21 @@ reply_setup_composer (EMsgComposer *composer,
 
        /* Set the subject of the new message. */
        if ((subject = (gchar *) camel_mime_message_get_subject (message))) {
+               GSettings *settings;
                gboolean skip_len = -1;
 
                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. 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);
+               settings = e_util_ref_settings ("org.gnome.evolution.mail");
+               if (g_settings_get_boolean (settings, "composer-use-localized-fwd-re")) {
+                       /* 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 {
+                       /* Do not localize this string */
+                       subject = g_strdup_printf ("Re: %s", subject);
+               }
+               g_clear_object (&settings);
        } else {
                subject = g_strdup ("");
        }
diff --git a/src/mail/mail-config.ui b/src/mail/mail-config.ui
index 3613380..ee94553 100644
--- a/src/mail/mail-config.ui
+++ b/src/mail/mail-config.ui
@@ -518,8 +518,8 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkCheckButton" id="chkReplyStartBottom">
-                        <property name="label" translatable="yes">Start _typing at the bottom</property>
+                      <object class="GtkCheckButton" id="chkUseLocalizedFwdRe">
+                        <property name="label" translatable="yes" comments="Translators: Do not localize the 
'Fwd' and 'Re' here, but feel free to show what it would be in your locale at the end of the string">Use 
_localized “Fwd”/“Re” in message Subject of Forwards and Replies</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
@@ -535,8 +535,8 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkCheckButton" id="chkTopSignature">
-                        <property name="label" translatable="yes">_Keep signature above the original 
message</property>
+                      <object class="GtkCheckButton" id="chkReplyStartBottom">
+                        <property name="label" translatable="yes">Start _typing at the bottom</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
@@ -552,8 +552,8 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkCheckButton" id="chkSignatureInNewOnly">
-                        <property name="label" translatable="yes">Include si_gnature in new messages 
only</property>
+                      <object class="GtkCheckButton" id="chkTopSignature">
+                        <property name="label" translatable="yes">_Keep signature above the original 
message</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
@@ -569,8 +569,8 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkCheckButton" id="chkIgnoreListReplyTo">
-                        <property name="label" translatable="yes">Ig_nore Reply-To: for mailing 
lists</property>
+                      <object class="GtkCheckButton" id="chkSignatureInNewOnly">
+                        <property name="label" translatable="yes">Include si_gnature in new messages 
only</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
@@ -586,8 +586,8 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkCheckButton" id="chkGroupReplyToList">
-                        <property name="label" translatable="yes">Gro_up Reply goes only to mailing list, if 
possible</property>
+                      <object class="GtkCheckButton" id="chkIgnoreListReplyTo">
+                        <property name="label" translatable="yes">Ig_nore Reply-To: for mailing 
lists</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
@@ -603,8 +603,8 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkCheckButton" id="chkSignReplyIfSigned">
-                        <property name="label" translatable="yes">Digitally _sign messages when original 
message signed (PGP or S/MIME)</property>
+                      <object class="GtkCheckButton" id="chkGroupReplyToList">
+                        <property name="label" translatable="yes">Gro_up Reply goes only to mailing list, if 
possible</property>
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="receives_default">False</property>
@@ -620,6 +620,23 @@
                       </packing>
                     </child>
                     <child>
+                      <object class="GtkCheckButton" id="chkSignReplyIfSigned">
+                        <property name="label" translatable="yes">Digitally _sign messages when original 
message signed (PGP or S/MIME)</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="xalign">0.5</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">8</property>
+                        <property name="bottom_attach">9</property>
+                        <property name="y_options"/>
+                      </packing>
+                    </child>
+                    <child>
                       <object class="GtkCheckButton" id="chkWrapQuotedTextInReplies">
                         <property name="label" translatable="yes">_Wrap quoted text in replies</property>
                         <property name="visible">True</property>
@@ -631,8 +648,8 @@
                       </object>
                       <packing>
                         <property name="right_attach">2</property>
-                        <property name="top_attach">8</property>
-                        <property name="bottom_attach">9</property>
+                        <property name="top_attach">9</property>
+                        <property name="bottom_attach">10</property>
                         <property name="y_options"/>
                       </packing>
                     </child>
diff --git a/src/modules/mail/em-composer-prefs.c b/src/modules/mail/em-composer-prefs.c
index 31d5484..89115ca 100644
--- a/src/modules/mail/em-composer-prefs.c
+++ b/src/modules/mail/em-composer-prefs.c
@@ -1192,6 +1192,12 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
                widget, "active",
                G_SETTINGS_BIND_DEFAULT);
 
+       widget = e_builder_get_widget (prefs->builder, "chkUseLocalizedFwdRe");
+       g_settings_bind (
+               settings, "composer-use-localized-fwd-re",
+               widget, "active",
+               G_SETTINGS_BIND_DEFAULT);
+
        widget = e_builder_get_widget (prefs->builder, "chkReplyStartBottom");
        g_settings_bind (
                settings, "composer-reply-start-bottom",


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