From 8e6db8859c756ef2445e1f5277103d83c735c726 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Wed, 9 Oct 2019 23:32:03 +0200 Subject: Plugins: Set UI texts in code instead of .ui files to fix translations Co-authored-by: srgcdev --- plugins/omemo/src/ui/contact_details_dialog.vala | 14 ++++++++++++++ plugins/omemo/src/ui/manage_key_dialog.vala | 12 ++++++++++++ 2 files changed, 26 insertions(+) (limited to 'plugins/omemo/src/ui') diff --git a/plugins/omemo/src/ui/contact_details_dialog.vala b/plugins/omemo/src/ui/contact_details_dialog.vala index eee06f0f..463b5cd7 100644 --- a/plugins/omemo/src/ui/contact_details_dialog.vala +++ b/plugins/omemo/src/ui/contact_details_dialog.vala @@ -17,7 +17,11 @@ public class ContactDetailsDialog : Gtk.Dialog { private bool own = false; private int own_id = 0; + [GtkChild] private Label automatically_accept_new_label; [GtkChild] private Label automatically_accept_new_descr; + [GtkChild] private Label own_key_label; + [GtkChild] private Label new_keys_label; + [GtkChild] private Label associated_keys_label; [GtkChild] private Box own_fingerprint_container; [GtkChild] private Label own_fingerprint_label; [GtkChild] private Box new_keys_container; @@ -30,6 +34,16 @@ public class ContactDetailsDialog : Gtk.Dialog { [GtkChild] private Image qrcode_image; [GtkChild] private Popover qrcode_popover; + construct { + // If we set the strings in the .ui file, they don't get translated + title = _("OMEMO Key Management"); + automatically_accept_new_label.label = _("Automatically accept new keys"); + automatically_accept_new_descr.label = _("When this contact adds new encryption keys to their account, automatically accept them."); + own_key_label.label = _("Own key"); + new_keys_label.label = _("New keys"); + associated_keys_label.label = _("Associated keys"); + } + public ContactDetailsDialog(Plugin plugin, Account account, Jid jid) { Object(use_header_bar : Environment.get_variable("GTK_CSD") != "0" ? 1 : 0); this.plugin = plugin; diff --git a/plugins/omemo/src/ui/manage_key_dialog.vala b/plugins/omemo/src/ui/manage_key_dialog.vala index bf003c41..663b8b7f 100644 --- a/plugins/omemo/src/ui/manage_key_dialog.vala +++ b/plugins/omemo/src/ui/manage_key_dialog.vala @@ -6,6 +6,7 @@ namespace Dino.Plugins.Omemo { [GtkTemplate (ui = "/im/dino/Dino/omemo/manage_key_dialog.ui")] public class ManageKeyDialog : Gtk.Dialog { + [GtkChild] private HeaderBar headerbar; [GtkChild] private Stack manage_stack; [GtkChild] private Button cancel_button; @@ -19,6 +20,7 @@ public class ManageKeyDialog : Gtk.Dialog { [GtkChild] private Label confirm_desc_label; [GtkChild] private Label verify_label; + [GtkChild] private Label compare_fingerprint_label; [GtkChild] private Button verify_yes_button; [GtkChild] private Button verify_no_button; @@ -28,6 +30,16 @@ public class ManageKeyDialog : Gtk.Dialog { private bool return_to_main; private int current_response; + construct { + // If we set the strings in the .ui file, they don't get translated + headerbar.title = _("Manage Key"); + compare_fingerprint_label.label = _("Compare the fingerprint, character by character, with the one shown on your contacts device."); + verify_no_button.label = _("Not matching"); + verify_yes_button.label = _("Matching"); + cancel_button.label = _("Cancel"); + ok_button.label = _("Confirm"); + } + public ManageKeyDialog(Row device, Database db) { Object(use_header_bar : Environment.get_variable("GTK_CSD") != "0" ? 1 : 0); -- cgit v1.2.3-70-g09d2