From d7b5db1d9fb37a310c16d8ffef885f1209a33187 Mon Sep 17 00:00:00 2001 From: Samuel Hand Date: Fri, 10 Aug 2018 12:47:56 +0100 Subject: [PATCH] Make strings translatable --- plugins/omemo/src/contact_details_dialog.vala | 8 ++--- plugins/omemo/src/manage_key_dialog.vala | 34 +++++++++---------- plugins/omemo/src/own_notifications.vala | 4 +-- plugins/omemo/src/trust_manager.vala | 4 +-- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/plugins/omemo/src/contact_details_dialog.vala b/plugins/omemo/src/contact_details_dialog.vala index 3a39bda5..baefe564 100644 --- a/plugins/omemo/src/contact_details_dialog.vala +++ b/plugins/omemo/src/contact_details_dialog.vala @@ -105,22 +105,22 @@ public class ContactDetailsDialog : Gtk.Dialog { switch(trust) { case Database.IdentityMetaTable.TrustLevel.TRUSTED: img.icon_name = "emblem-ok-symbolic"; - status_lbl.set_markup("Accepted"); + status_lbl.set_markup("%s".printf(_("Accepted"))); break; case Database.IdentityMetaTable.TrustLevel.UNTRUSTED: img.icon_name = "action-unavailable-symbolic"; - status_lbl.set_markup("Rejected"); + status_lbl.set_markup("%s".printf(_("Rejected"))); lbl.get_style_context().add_class("dim-label"); break; case Database.IdentityMetaTable.TrustLevel.VERIFIED: img.icon_name = "security-high-symbolic"; - status_lbl.set_markup("Verified"); + status_lbl.set_markup("%s".printf(_("Verified"))); break; } if (!now_active) { img.icon_name= "appointment-missed-symbolic"; - status_lbl.set_markup("Unused"); + status_lbl.set_markup("%s".printf(_("Unused"))); lbr.activatable = false; } } diff --git a/plugins/omemo/src/manage_key_dialog.vala b/plugins/omemo/src/manage_key_dialog.vala index 1ff7bd27..602b2965 100644 --- a/plugins/omemo/src/manage_key_dialog.vala +++ b/plugins/omemo/src/manage_key_dialog.vala @@ -48,8 +48,8 @@ public class ManageKeyDialog : Gtk.Dialog { verify_yes_button.clicked.connect(() => { confirm_image.set_from_icon_name("security-high-symbolic", IconSize.DIALOG); - confirm_title_label.label = "Verify key"; - confirm_desc_label.set_markup(@"Once confirmed, any future messages sent by $(device[db.identity_meta.address_name]) using this key will be highlighted accordingly in the chat window."); + confirm_title_label.label = _("Verify key"); + confirm_desc_label.set_markup(_("Once confirmed, any future messages sent by %s using this key will be highlighted accordingly in the chat window.").printf(@"$(device[db.identity_meta.address_name])")); manage_stack.set_visible_child_name("confirm"); ok_button.sensitive = true; return_to_main = false; @@ -59,8 +59,8 @@ public class ManageKeyDialog : Gtk.Dialog { verify_no_button.clicked.connect(() => { return_to_main = false; confirm_image.set_from_icon_name("dialog-warning-symbolic", IconSize.DIALOG); - confirm_title_label.label = "Fingerprints do not match"; - confirm_desc_label.set_markup(@"Please verify that you are comparing the correct fingerprint. If fingerprints do not match $(device[db.identity_meta.address_name])'s account may be compromised and you should consider rejecting this key."); + confirm_title_label.label = _("Fingerprints do not match"); + confirm_desc_label.set_markup(_("Please verify that you are comparing the correct fingerprint. If fingerprints do not match %s's account may be compromised and you should consider rejecting this key.").printf(@"$(device[db.identity_meta.address_name])")); manage_stack.set_visible_child_name("confirm"); }); } @@ -70,13 +70,13 @@ public class ManageKeyDialog : Gtk.Dialog { if (manage_stack.get_visible_child_name() == "verify") { manage_stack.set_visible_child_name("main"); - cancel_button.label = "Cancel"; + cancel_button.label = _("Cancel"); } if (manage_stack.get_visible_child_name() == "confirm") { if (return_to_main) { manage_stack.set_visible_child_name("main"); - cancel_button.label = "Cancel"; + cancel_button.label = _("Cancel"); } else { manage_stack.set_visible_child_name("verify"); } @@ -133,24 +133,24 @@ public class ManageKeyDialog : Gtk.Dialog { }); ListBoxRow verify_row = new ListBoxRow() { visible = true }; - verify_row.add(make_action_box("Verify Key Fingerprint", "Compare this key's fingerprint with the fingerprint displayed on the contact's device.")); + verify_row.add(make_action_box(_("Verify Key Fingerprint"), _("Compare this key's fingerprint with the fingerprint displayed on the contact's device."))); ListBoxRow reject_row = new ListBoxRow() { visible = true }; - reject_row.add(make_action_box("Reject Key", "Stop accepting this key during communication with its associated contact.")); + reject_row.add(make_action_box(_("Reject Key"), _("Stop accepting this key during communication with its associated contact."))); ListBoxRow accept_row = new ListBoxRow() {visible = true }; - accept_row.add(make_action_box("Accept Key", "Start accepting this key during communication with its assoicated contact")); + accept_row.add(make_action_box(_("Accept Key"), _("Start accepting this key during communication with its assoicated contact"))); switch((Database.IdentityMetaTable.TrustLevel) device[db.identity_meta.trust_level]) { case Database.IdentityMetaTable.TrustLevel.TRUSTED: - main_desc_label.set_markup(@"This key is currently accepted. This means it can be used by $(device[db.identity_meta.address_name]) to receive and send messages."); + main_desc_label.set_markup(_("This key is currently %saccepted%s. This means it can be used by %s to receive and send messages.").printf("", "", @"$(device[db.identity_meta.address_name])")); main_action_list.add(verify_row); main_action_list.add(reject_row); break; case Database.IdentityMetaTable.TrustLevel.VERIFIED: - main_desc_label.set_markup(@"This key is currently verified. This means it can be used by $(device[db.identity_meta.address_name]) to receive and send messages. Additionaly it has been verified out-of-band to match the key on the contact's device."); + main_desc_label.set_markup(_("This key is currently %sverified%s. This means it can be used by %s to receive and send messages. Additionally it has been verified out-of-band to match the key on the contact's device.").printf("", "", @"$(device[db.identity_meta.address_name])")); main_action_list.add(reject_row); break; case Database.IdentityMetaTable.TrustLevel.UNTRUSTED: - main_desc_label.set_markup(@"This key is currently rejected. This means it cannot be used by $(device[db.identity_meta.address_name]) to receive messages, and any messages sent by it will be ignored"); + main_desc_label.set_markup(_("This key is currently %srejected%s. This means it cannot be used by %s to receive messages, and any messages sent by it will be ignored").printf("", "", @"$(device[db.identity_meta.address_name])")); main_action_list.add(accept_row); break; } @@ -161,22 +161,22 @@ public class ManageKeyDialog : Gtk.Dialog { manage_stack.set_visible_child_name("verify"); } else if (row == reject_row) { confirm_image.set_from_icon_name("action-unavailable-symbolic", IconSize.DIALOG); - confirm_title_label.label = "Reject key"; - confirm_desc_label.set_markup(@"Once confirmed, any future messages sent by $(device[db.identity_meta.address_name]) using this key will be ignored and none of your messages will be readable using this key."); + confirm_title_label.label = _("Reject key"); + confirm_desc_label.set_markup(_("Once confirmed, any future messages sent by %s using this key will be ignored and none of your messages will be readable using this key.").printf(@"$(device[db.identity_meta.address_name])")); manage_stack.set_visible_child_name("confirm"); ok_button.sensitive = true; return_to_main = true; current_response = Database.IdentityMetaTable.TrustLevel.UNTRUSTED; } else if (row == accept_row) { confirm_image.set_from_icon_name("emblem-ok-symbolic", IconSize.DIALOG); - confirm_title_label.label = "Accept key"; - confirm_desc_label.set_markup(@"Once confirmed this key will be usable by $(device[db.identity_meta.address_name]) to receive and send messages."); + confirm_title_label.label = _("Accept key"); + confirm_desc_label.set_markup(_("Once confirmed this key will be usable by %s to receive and send messages.").printf(@"$(device[db.identity_meta.address_name])")); manage_stack.set_visible_child_name("confirm"); ok_button.sensitive = true; return_to_main = true; current_response = Database.IdentityMetaTable.TrustLevel.TRUSTED; } - cancel_button.label = "Back"; + cancel_button.label = _("Back"); }); manage_stack.set_visible_child_name("main"); diff --git a/plugins/omemo/src/own_notifications.vala b/plugins/omemo/src/own_notifications.vala index fbdb7e84..296e00b6 100644 --- a/plugins/omemo/src/own_notifications.vala +++ b/plugins/omemo/src/own_notifications.vala @@ -30,8 +30,8 @@ public class OwnNotifications { } private void display_notification() { - Notification notification = new Notification("Trust decision required"); - notification.set_body(@"A new OMEMO device has been added for the account $(account.bare_jid)"); + Notification notification = new Notification(_("Trust decision required")); + notification.set_body(_("A new OMEMO device has been added for the account %s").printf("$(account.jid.bare_jid)")); plugin.app.send_notification(account.id.to_string()+"-new-device", notification); } } diff --git a/plugins/omemo/src/trust_manager.vala b/plugins/omemo/src/trust_manager.vala index 3890d4da..9f1ad047 100644 --- a/plugins/omemo/src/trust_manager.vala +++ b/plugins/omemo/src/trust_manager.vala @@ -170,11 +170,11 @@ public class TrustManager { } Database.IdentityMetaTable.TrustLevel trust_level = (Database.IdentityMetaTable.TrustLevel) db.identity_meta.get_device(conversation.account.id, jid.bare_jid.to_string(), header.get_attribute_int("sid"))[db.identity_meta.trust_level]; if (trust_level == Database.IdentityMetaTable.TrustLevel.UNTRUSTED) { - message.body = "OMEMO message from a rejected device"; + message.body = _("OMEMO message from a rejected device"); message.marked = Message.Marked.WONTSEND; } if (trust_level == Database.IdentityMetaTable.TrustLevel.UNKNOWN) { - message.body = "OMEMO message from an unknown device: "+message.body; + message.body = _("OMEMO message from an unknown device: ")+message.body; message.marked = Message.Marked.WONTSEND; } }