[geary] Unify translations for RFC-822 header labels



commit 430609c36490d77d0d4ff530dead68fd73deb04a
Author: Michael Gratton <mike vee net>
Date:   Tue Feb 12 11:00:17 2019 +1100

    Unify translations for RFC-822 header labels
    
    See #210

 src/client/composer/composer-widget.vala           | 36 ++++++++++++++--------
 .../conversation-viewer/conversation-email.vala    |  5 +++
 src/engine/rfc822/rfc822-utils.vala                | 26 +++++++++++-----
 3 files changed, 47 insertions(+), 20 deletions(-)
---
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index 525d6275..f5d9cb17 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -1688,18 +1688,30 @@ public class ComposerWidget : Gtk.EventBox, Geary.BaseInterface {
         string label = this.to_entry.buffer.text + (tocc ? ", " : "")
             + this.cc_entry.buffer.text + (ccbcc ? ", " : "") + this.bcc_entry.buffer.text;
         StringBuilder tooltip = new StringBuilder();
-        if (to_entry.addresses != null)
-            foreach(Geary.RFC822.MailboxAddress addr in this.to_entry.addresses)
-                tooltip.append(_("To: ") + addr.to_full_display() + "\n");
-        if (cc_entry.addresses != null)
-            foreach(Geary.RFC822.MailboxAddress addr in this.cc_entry.addresses)
-                tooltip.append(_("Cc: ") + addr.to_full_display() + "\n");
-        if (bcc_entry.addresses != null)
-            foreach(Geary.RFC822.MailboxAddress addr in this.bcc_entry.addresses)
-                tooltip.append(_("Bcc: ") + addr.to_full_display() + "\n");
-        if (reply_to_entry.addresses != null)
-            foreach(Geary.RFC822.MailboxAddress addr in this.reply_to_entry.addresses)
-                tooltip.append(_("Reply-To: ") + addr.to_full_display() + "\n");
+        if (to_entry.addresses != null) {
+            foreach(Geary.RFC822.MailboxAddress addr in this.to_entry.addresses) {
+                // Translators: Human-readable version of the RFC 822 To header
+                tooltip.append("%s %s\n".printf(_("To:"), addr.to_full_display()));
+            }
+        }
+        if (cc_entry.addresses != null) {
+            foreach(Geary.RFC822.MailboxAddress addr in this.cc_entry.addresses) {
+                // Translators: Human-readable version of the RFC 822 CC header
+                tooltip.append("%s %s\n".printf(_("Cc:"), addr.to_full_display()));
+            }
+        }
+        if (bcc_entry.addresses != null) {
+            foreach(Geary.RFC822.MailboxAddress addr in this.bcc_entry.addresses) {
+                // Translators: Human-readable version of the RFC 822 BCC header
+                tooltip.append("%s %s\n".printf(_("Bcc:"), addr.to_full_display()));
+            }
+        }
+        if (reply_to_entry.addresses != null) {
+            foreach(Geary.RFC822.MailboxAddress addr in this.reply_to_entry.addresses) {
+                // Translators: Human-readable version of the RFC 822 Reply-To header
+                tooltip.append("%s %s\n".printf(_("Reply-To:"), addr.to_full_display()));
+            }
+        }
         this.header.set_recipients(label, tooltip.str.slice(0, -1));  // Remove trailing \n
     }
 
diff --git a/src/client/conversation-viewer/conversation-email.vala 
b/src/client/conversation-viewer/conversation-email.vala
index 6ab8311a..d55295d8 100644
--- a/src/client/conversation-viewer/conversation-email.vala
+++ b/src/client/conversation-viewer/conversation-email.vala
@@ -965,22 +965,27 @@ public class ConversationEmail : Gtk.Box, Geary.BaseInterface {
             builder.add_string_value(this.email.from.to_string());
         }
         if (this.email.to != null) {
+            // Translators: Human-readable version of the RFC 822 To header
             builder.set_member_name(_("To:"));
             builder.add_string_value(this.email.to.to_string());
         }
         if (this.email.cc != null) {
+            // Translators: Human-readable version of the RFC 822 CC header
             builder.set_member_name(_("Cc:"));
             builder.add_string_value(this.email.cc.to_string());
         }
         if (this.email.bcc != null) {
+            // Translators: Human-readable version of the RFC 822 BCC header
             builder.set_member_name(_("Bcc:"));
             builder.add_string_value(this.email.bcc.to_string());
         }
         if (this.email.date != null) {
+            // Translators: Human-readable version of the RFC 822 Date header
             builder.set_member_name(_("Date:"));
             builder.add_string_value(this.email.date.to_string());
         }
         if (this.email.subject != null) {
+            // Translators: Human-readable version of the RFC 822 Subject header
             builder.set_member_name(_("Subject:"));
             builder.add_string_value(this.email.subject.to_string());
         }
diff --git a/src/engine/rfc822/rfc822-utils.vala b/src/engine/rfc822/rfc822-utils.vala
index 7087cb7f..85301913 100644
--- a/src/engine/rfc822/rfc822-utils.vala
+++ b/src/engine/rfc822/rfc822-utils.vala
@@ -279,19 +279,29 @@ public string quote_email_for_forward(Geary.Email email, string? quote, TextForm
     if (email.body == null && quote == null)
         return "";
 
+    const string HEADER_FORMAT = "%s %s\n";
+
     string quoted = _("---------- Forwarded message ----------");
     quoted += "\n";
     string from_line = email_addresses_for_reply(email.from, format);
-    if (!String.is_empty_or_whitespace(from_line))
-        quoted += _("From: %s\n").printf(from_line);
-    quoted += _("Subject: %s\n").printf(email.subject != null ? email.subject.to_string() : "");
-    quoted += _("Date: %s\n").printf(email.date != null ? email.date.to_string() : "");
+    if (!String.is_empty_or_whitespace(from_line)) {
+        // Translators: Human-readable version of the RFC 822 From header
+        quoted += HEADER_FORMAT.printf(_("From:"), from_line);
+    }
+    // Translators: Human-readable version of the RFC 822 Subject header
+    quoted += HEADER_FORMAT.printf(_("Subject:"), email.subject != null ? email.subject.to_string() : "");
+    // Translators: Human-readable version of the RFC 822 Date header
+    quoted += HEADER_FORMAT.printf(_("Date:"), email.date != null ? email.date.to_string() : "");
     string to_line = email_addresses_for_reply(email.to, format);
-    if (!String.is_empty_or_whitespace(to_line))
-        quoted += _("To: %s\n").printf(to_line);
+    if (!String.is_empty_or_whitespace(to_line)) {
+        // Translators: Human-readable version of the RFC 822 To header
+        quoted += HEADER_FORMAT.printf(_("To:"), to_line);
+    }
     string cc_line = email_addresses_for_reply(email.cc, format);
-    if (!String.is_empty_or_whitespace(cc_line))
-        quoted += _("Cc: %s\n").printf(cc_line);
+    if (!String.is_empty_or_whitespace(cc_line)) {
+        // Translators: Human-readable version of the RFC 822 CC header
+        quoted += HEADER_FORMAT.printf(_("Cc:"), cc_line);
+    }
     quoted += "\n";  // A blank line between headers and body
     quoted = quoted.replace("\n", "<br />");
     try {


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