diff options
author | fiaxh <git@lightrise.org> | 2019-10-09 23:32:03 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2019-10-10 00:21:45 +0200 |
commit | 8e6db8859c756ef2445e1f5277103d83c735c726 (patch) | |
tree | 7ac396525e13da4ee37d7983039cafc00307586b /plugins/omemo | |
parent | 7adb0e82fba1afc62689797be6c9491ad15d03bf (diff) | |
download | dino-8e6db8859c756ef2445e1f5277103d83c735c726.tar.gz dino-8e6db8859c756ef2445e1f5277103d83c735c726.zip |
Plugins: Set UI texts in code instead of .ui files to fix translations
Co-authored-by: srgcdev <srg.dev@posteo.net>
Diffstat (limited to 'plugins/omemo')
-rw-r--r-- | plugins/omemo/data/contact_details_dialog.ui | 14 | ||||
-rw-r--r-- | plugins/omemo/data/manage_key_dialog.ui | 12 | ||||
-rw-r--r-- | plugins/omemo/src/ui/contact_details_dialog.vala | 14 | ||||
-rw-r--r-- | plugins/omemo/src/ui/manage_key_dialog.vala | 12 |
4 files changed, 33 insertions, 19 deletions
diff --git a/plugins/omemo/data/contact_details_dialog.ui b/plugins/omemo/data/contact_details_dialog.ui index 1f3e9afa..50e19eee 100644 --- a/plugins/omemo/data/contact_details_dialog.ui +++ b/plugins/omemo/data/contact_details_dialog.ui @@ -2,7 +2,6 @@ <interface> <template class="DinoPluginsOmemoContactDetailsDialog"> <property name="modal">True</property> - <property name="title" translatable="yes">OMEMO Key Management</property> <property name="resizable">False</property> <child internal-child="vbox"> <object class="GtkBox"> @@ -35,10 +34,9 @@ <property name="orientation">vertical</property> <property name="hexpand">True</property> <child> - <object class="GtkLabel"> + <object class="GtkLabel" id="automatically_accept_new_label"> <property name="visible">True</property> <property name="halign">start</property> - <property name="label" translatable="yes">Automatically accept new keys</property> <attributes> <attribute name="scale" value="1.1"/> </attributes> @@ -51,7 +49,6 @@ <property name="expand">True</property> <property name="xalign">0</property> <property name="wrap">True</property> - <property name="label" translatable="yes">When this contact adds new encryption keys to their account, automatically accept them.</property> <attributes> <attribute name="scale" value="0.8"/> </attributes> @@ -83,10 +80,9 @@ <property name="orientation">vertical</property> <property name="spacing">2</property> <child> - <object class="GtkLabel"> + <object class="GtkLabel" id="own_key_label"> <property name="visible">True</property> <property name="halign">start</property> - <property name="label" translatable="yes">Own key</property> <attributes> <attribute name="weight" value="PANGO_WEIGHT_BOLD"/> </attributes> @@ -174,10 +170,9 @@ <property name="orientation">vertical</property> <property name="spacing">2</property> <child> - <object class="GtkLabel"> + <object class="GtkLabel" id="new_keys_label"> <property name="visible">True</property> <property name="halign">start</property> - <property name="label" translatable="yes">New keys</property> <attributes> <attribute name="weight" value="PANGO_WEIGHT_BOLD"/> </attributes> @@ -210,10 +205,9 @@ <property name="orientation">vertical</property> <property name="spacing">2</property> <child> - <object class="GtkLabel"> + <object class="GtkLabel" id="associated_keys_label"> <property name="visible">True</property> <property name="halign">start</property> - <property name="label" translatable="yes">Associated keys</property> <attributes> <attribute name="weight" value="PANGO_WEIGHT_BOLD"/> </attributes> diff --git a/plugins/omemo/data/manage_key_dialog.ui b/plugins/omemo/data/manage_key_dialog.ui index 7c739967..dcec4c90 100644 --- a/plugins/omemo/data/manage_key_dialog.ui +++ b/plugins/omemo/data/manage_key_dialog.ui @@ -4,13 +4,11 @@ <property name="modal">True</property> <property name="resizable">False</property> <child type="titlebar"> - <object class="GtkHeaderBar" id="header_bar"> + <object class="GtkHeaderBar" id="headerbar"> <property name="visible">True</property> - <property name="title" translatable="yes">Manage Key</property> <property name="show_close_button">False</property> <child> <object class="GtkButton" id="cancel_button"> - <property name="label" translatable="yes">Cancel</property> <property name="sensitive">True</property> <property name="visible">True</property> </object> @@ -22,7 +20,6 @@ <object class="GtkButton" id="ok_button"> <property name="has_default">True</property> <property name="can_default">True</property> - <property name="label" translatable="yes">Confirm</property> <property name="sensitive">False</property> <property name="visible">True</property> <style> @@ -81,11 +78,10 @@ <property name="orientation">vertical</property> <property name="valign">center</property> <child> - <object class="GtkLabel"> + <object class="GtkLabel" id="compare_fingerprint_label"> <property name="visible">True</property> - <property name="label" translatable="yes">Compare the fingerprint, character by character, with the one shown on your contacts device.</property> <property name="wrap">True</property> - <property name="xalign">0</property> + <property name="xalign">0.5</property> <property name="max-width-chars">45</property> </object> </child> @@ -110,14 +106,12 @@ <object class="GtkButton" id="verify_no_button"> <property name="visible">True</property> <property name="hexpand">True</property> - <property name="label" translatable="yes">Not matching</property> </object> </child> <child> <object class="GtkButton" id="verify_yes_button"> <property name="visible">True</property> <property name="hexpand">True</property> - <property name="label" translatable="yes">Matching</property> </object> </child> </object> 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); |