Commit 430609c3 authored by Michael Gratton's avatar Michael Gratton 🤞 Committed by Michael Gratton

Unify translations for RFC-822 header labels

See #210
parent 9aefdf36
Pipeline #58393 passed with stages
in 8 minutes and 19 seconds
......@@ -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
}
......
......@@ -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());
}
......
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment