aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-04-07 11:09:47 +0200
committerfiaxh <git@mx.ax.lt>2017-04-10 15:47:21 +0200
commit9bc83539d124f9645dc92e9e39001cb0192dae61 (patch)
treea4b22a8ea3e10b6d0050c2e5669729919a1cb477 /plugins
parentd8881c4b16a1cd376dd69304c44444aee581da32 (diff)
downloaddino-9bc83539d124f9645dc92e9e39001cb0192dae61.tar.gz
dino-9bc83539d124f9645dc92e9e39001cb0192dae61.zip
Gettext support
Diffstat (limited to 'plugins')
-rw-r--r--plugins/omemo/CMakeLists.txt9
-rw-r--r--plugins/omemo/po/LINGUAS2
-rw-r--r--plugins/omemo/po/POTFILES.in1
-rw-r--r--plugins/omemo/po/de.po22
-rw-r--r--plugins/omemo/po/dino-omemo.pot22
-rw-r--r--plugins/omemo/po/en.po9
-rw-r--r--plugins/omemo/src/account_settings_widget.vala6
-rw-r--r--plugins/omemo/src/plugin.vala5
-rw-r--r--plugins/openpgp/CMakeLists.txt10
-rw-r--r--plugins/openpgp/po/LINGUAS2
-rw-r--r--plugins/openpgp/po/POTFILES.in1
-rw-r--r--plugins/openpgp/po/de.po34
-rw-r--r--plugins/openpgp/po/dino-openpgp.pot34
-rw-r--r--plugins/openpgp/po/en.po9
-rw-r--r--plugins/openpgp/src/account_settings_widget.vala10
-rw-r--r--plugins/openpgp/src/plugin.vala5
16 files changed, 169 insertions, 12 deletions
diff --git a/plugins/omemo/CMakeLists.txt b/plugins/omemo/CMakeLists.txt
index 7f031714..ed9cfd22 100644
--- a/plugins/omemo/CMakeLists.txt
+++ b/plugins/omemo/CMakeLists.txt
@@ -1,3 +1,8 @@
+set(GETTEXT_PACKAGE "dino-omemo")
+find_package(Gettext)
+include(${GETTEXT_USE_FILE})
+gettext_compile(${GETTEXT_PACKAGE} SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/po TARGET_NAME ${GETTEXT_PACKAGE}-translations)
+
find_packages(OMEMO_PACKAGES REQUIRED
Gee
GLib
@@ -31,9 +36,9 @@ PACKAGES
${OMEMO_PACKAGES}
)
-add_definitions(${VALA_CFLAGS})
+add_definitions(${VALA_CFLAGS} -DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DLOCALE_INSTALL_DIR=\"${LOCALE_INSTALL_DIR}\")
add_library(omemo SHARED ${OMEMO_VALA_C})
-add_dependencies(omemo dino-vapi signal-protocol-vapi)
+add_dependencies(omemo dino-vapi signal-protocol-vapi ${GETTEXT_PACKAGE}-translations)
target_link_libraries(omemo libdino signal-protocol-vala ${OMEMO_PACKAGES})
set_target_properties(omemo PROPERTIES PREFIX "")
set_target_properties(omemo PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins/)
diff --git a/plugins/omemo/po/LINGUAS b/plugins/omemo/po/LINGUAS
new file mode 100644
index 00000000..685f65ef
--- /dev/null
+++ b/plugins/omemo/po/LINGUAS
@@ -0,0 +1,2 @@
+de
+en \ No newline at end of file
diff --git a/plugins/omemo/po/POTFILES.in b/plugins/omemo/po/POTFILES.in
new file mode 100644
index 00000000..d5454a22
--- /dev/null
+++ b/plugins/omemo/po/POTFILES.in
@@ -0,0 +1 @@
+src/account_settings_widget.vala \ No newline at end of file
diff --git a/plugins/omemo/po/de.po b/plugins/omemo/po/de.po
new file mode 100644
index 00000000..89aebf80
--- /dev/null
+++ b/plugins/omemo/po/de.po
@@ -0,0 +1,22 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: dino-omemo-0.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-04-07 15:43+0200\n"
+"Language: en\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/account_settings_widget.vala:35 src/account_settings_widget.vala:52
+#: src/account_settings_widget.vala:55
+msgid "Own fingerprint"
+msgstr "Eigener Fingerabdruck"
+
+#: src/account_settings_widget.vala:35
+msgid "Will be generated on first connect"
+msgstr "Wird beim ersten Verbinden erzeugt"
+
+#: src/account_settings_widget.vala:55
+msgid "Database error"
+msgstr "Datenbank Fehler"
diff --git a/plugins/omemo/po/dino-omemo.pot b/plugins/omemo/po/dino-omemo.pot
new file mode 100644
index 00000000..4d3c583a
--- /dev/null
+++ b/plugins/omemo/po/dino-omemo.pot
@@ -0,0 +1,22 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: dino-omemo-0.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-04-07 15:43+0200\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/account_settings_widget.vala:35 src/account_settings_widget.vala:52
+#: src/account_settings_widget.vala:55
+msgid "Own fingerprint"
+msgstr ""
+
+#: src/account_settings_widget.vala:35
+msgid "Will be generated on first connect"
+msgstr ""
+
+#: src/account_settings_widget.vala:55
+msgid "Database error"
+msgstr ""
diff --git a/plugins/omemo/po/en.po b/plugins/omemo/po/en.po
new file mode 100644
index 00000000..c98175e3
--- /dev/null
+++ b/plugins/omemo/po/en.po
@@ -0,0 +1,9 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: dino-omemo-0.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-04-07 15:43+0200\n"
+"Language: en\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n" \ No newline at end of file
diff --git a/plugins/omemo/src/account_settings_widget.vala b/plugins/omemo/src/account_settings_widget.vala
index b922c9a6..bc0be3a8 100644
--- a/plugins/omemo/src/account_settings_widget.vala
+++ b/plugins/omemo/src/account_settings_widget.vala
@@ -32,7 +32,7 @@ public class AccountSettingWidget : Plugins.AccountSettingsWidget, Box {
try {
Qlite.Row? row = plugin.db.identity.row_with(plugin.db.identity.account_id, account.id).inner;
if (row == null) {
- fingerprint.set_markup(@"Own fingerprint\n<span font='8'>Will be generated on first connect</span>");
+ fingerprint.set_markup("%s\n<span font='8'>%s</span>".printf(_("Own fingerprint"), _("Will be generated on first connect")));
} else {
uint8[] arr = Base64.decode(row[plugin.db.identity.identity_key_public_base64]);
arr = arr[1:arr.length];
@@ -49,10 +49,10 @@ public class AccountSettingWidget : Plugins.AccountSettingsWidget, Box {
}
}
}
- fingerprint.set_markup(@"Own fingerprint\n<span font_family='monospace' font='8'>$res</span>");
+ fingerprint.set_markup("%s\n<span font_family='monospace' font='8'>%s</span>".printf(_("Own fingerprint"), res));
}
} catch (Qlite.DatabaseError e) {
- fingerprint.set_markup(@"Own fingerprint\n<span font='8'>Database error</span>");
+ fingerprint.set_markup("%s\n<span font='8'>%s</span>".printf(_("Own fingerprint"), _("Database error")));
}
}
diff --git a/plugins/omemo/src/plugin.vala b/plugins/omemo/src/plugin.vala
index 811ecc32..6a7fc3de 100644
--- a/plugins/omemo/src/plugin.vala
+++ b/plugins/omemo/src/plugin.vala
@@ -1,3 +1,6 @@
+extern const string GETTEXT_PACKAGE;
+extern const string LOCALE_INSTALL_DIR;
+
namespace Dino.Plugins.Omemo {
public class Plugin : RootInterface, Object {
@@ -22,6 +25,8 @@ public class Plugin : RootInterface, Object {
list.add(new StreamModule());
});
Manager.start(this.app.stream_interaction, db);
+
+ internationalize(GETTEXT_PACKAGE, app.search_path_generator.get_locale_path(GETTEXT_PACKAGE, LOCALE_INSTALL_DIR));
} catch (Error e) {
print(@"Error initializing OMEMO: $(e.message)\n");
}
diff --git a/plugins/openpgp/CMakeLists.txt b/plugins/openpgp/CMakeLists.txt
index 9a1a9d46..b207dc4f 100644
--- a/plugins/openpgp/CMakeLists.txt
+++ b/plugins/openpgp/CMakeLists.txt
@@ -1,3 +1,9 @@
+set(GETTEXT_PACKAGE "dino-openpgp")
+find_package(Gettext)
+include(${GETTEXT_USE_FILE})
+gettext_compile(${GETTEXT_PACKAGE} SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/po TARGET_NAME ${GETTEXT_PACKAGE}-translations)
+
+
find_packages(OPENPGP_PACKAGES REQUIRED
Gee
GLib>=2.38
@@ -42,9 +48,9 @@ GRESOURCES
${OPENPGP_GRESOURCES_XML}
)
-add_definitions(${VALA_CFLAGS})
+add_definitions(${VALA_CFLAGS} -DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DLOCALE_INSTALL_DIR=\"${LOCALE_INSTALL_DIR}\")
add_library(openpgp SHARED ${OPENPGP_VALA_C} ${OPENPGP_GRESOURCES_TARGET})
-add_dependencies(openpgp dino-vapi gpgme-vapi)
+add_dependencies(openpgp dino-vapi gpgme-vapi ${GETTEXT_PACKAGE}-translations)
target_link_libraries(openpgp libdino gpgme-vala ${OPENPGP_PACKAGES})
set_target_properties(openpgp PROPERTIES PREFIX "")
set_target_properties(openpgp PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins/)
diff --git a/plugins/openpgp/po/LINGUAS b/plugins/openpgp/po/LINGUAS
new file mode 100644
index 00000000..685f65ef
--- /dev/null
+++ b/plugins/openpgp/po/LINGUAS
@@ -0,0 +1,2 @@
+de
+en \ No newline at end of file
diff --git a/plugins/openpgp/po/POTFILES.in b/plugins/openpgp/po/POTFILES.in
new file mode 100644
index 00000000..d5454a22
--- /dev/null
+++ b/plugins/openpgp/po/POTFILES.in
@@ -0,0 +1 @@
+src/account_settings_widget.vala \ No newline at end of file
diff --git a/plugins/openpgp/po/de.po b/plugins/openpgp/po/de.po
new file mode 100644
index 00000000..72b80946
--- /dev/null
+++ b/plugins/openpgp/po/de.po
@@ -0,0 +1,34 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: dino-openpgp-0.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-04-07 15:43+0200\n"
+"Language: de\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/account_settings_widget.vala:74 src/account_settings_widget.vala:80
+#: src/account_settings_widget.vala:108
+msgid "Key publishing disabled"
+msgstr "Schlüsselveröffentlichung deaktiviert"
+
+#: src/account_settings_widget.vala:74
+msgid "No keys available. Generate one!"
+msgstr "Keine Schlüssel vorhanden. Erzeuge einen!"
+
+#: src/account_settings_widget.vala:80
+msgid "Select key"
+msgstr "Wähle Schlüssel"
+
+#: src/account_settings_widget.vala:97
+msgid "Loading..."
+msgstr "Lade..."
+
+#: src/account_settings_widget.vala:97
+msgid "Querying GnuPG"
+msgstr "Frage GnuPG ab"
+
+#: src/account_settings_widget.vala:108
+msgid "Error in GnuPG"
+msgstr "Fehler in GnuPG"
diff --git a/plugins/openpgp/po/dino-openpgp.pot b/plugins/openpgp/po/dino-openpgp.pot
new file mode 100644
index 00000000..6723816c
--- /dev/null
+++ b/plugins/openpgp/po/dino-openpgp.pot
@@ -0,0 +1,34 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: dino-openpgp-0.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-04-07 15:43+0200\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/account_settings_widget.vala:74 src/account_settings_widget.vala:80
+#: src/account_settings_widget.vala:108
+msgid "Key publishing disabled"
+msgstr ""
+
+#: src/account_settings_widget.vala:74
+msgid "No keys available. Generate one!"
+msgstr ""
+
+#: src/account_settings_widget.vala:80
+msgid "Select key"
+msgstr ""
+
+#: src/account_settings_widget.vala:97
+msgid "Loading..."
+msgstr ""
+
+#: src/account_settings_widget.vala:97
+msgid "Querying GnuPG"
+msgstr ""
+
+#: src/account_settings_widget.vala:108
+msgid "Error in GnuPG"
+msgstr ""
diff --git a/plugins/openpgp/po/en.po b/plugins/openpgp/po/en.po
new file mode 100644
index 00000000..55ee0060
--- /dev/null
+++ b/plugins/openpgp/po/en.po
@@ -0,0 +1,9 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: dino-openpgp-0.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-04-07 15:43+0200\n"
+"Language: en\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n" \ No newline at end of file
diff --git a/plugins/openpgp/src/account_settings_widget.vala b/plugins/openpgp/src/account_settings_widget.vala
index 026d7d3c..77121352 100644
--- a/plugins/openpgp/src/account_settings_widget.vala
+++ b/plugins/openpgp/src/account_settings_widget.vala
@@ -71,13 +71,13 @@ private class AccountSettingsWidget : Stack, Plugins.AccountSettingsWidget {
private void populate_list_store() {
if (keys.size == 0) {
- label.set_markup(build_markup_string("Key publishing disabled", "No keys available. Generate one!"));
+ label.set_markup(build_markup_string(_("Key publishing disabled"), _("No keys available. Generate one!")));
return;
}
TreeIter iter;
list_store.append(out iter);
- list_store.set(iter, 0, build_markup_string("Key publishing disabled", "Select key"), 1, "");
+ list_store.set(iter, 0, build_markup_string(_("Key publishing disabled"), _("Select key")), 1, "");
for (int i = 0; i < keys.size; i++) {
list_store.append(out iter);
list_store.set(iter, 0, @"$(Markup.escape_text(keys[i].uids[0].uid))\n<span font_family='monospace' font='8'>0x$(Markup.escape_text(keys[i].fpr[0:16]))</span>");
@@ -94,7 +94,7 @@ private class AccountSettingsWidget : Stack, Plugins.AccountSettingsWidget {
TreeIter iter;
list_store.clear();
list_store.append(out iter);
- label.set_markup(build_markup_string("Loading...", "Querying GnuPG"));
+ label.set_markup(build_markup_string(_("Loading..."), _("Querying GnuPG")));
new Thread<void*> (null, () => { // Querying GnuPG might take some time
try {
keys = GPGHelper.get_keylist(null, true);
@@ -105,7 +105,7 @@ private class AccountSettingsWidget : Stack, Plugins.AccountSettingsWidget {
});
} catch (Error e) {
Idle.add(() => {
- label.set_markup(build_markup_string("Key publishing disabled", "Error in GnuPG"));
+ label.set_markup(build_markup_string(_("Key publishing disabled"), _("Error in GnuPG")));
return false;
});
}
@@ -139,7 +139,7 @@ private class AccountSettingsWidget : Stack, Plugins.AccountSettingsWidget {
}
private string build_markup_string(string primary, string secondary) {
- return @"$(Markup.escape_text(primary))\n<span font='9'>$(Markup.escape_text(secondary))</span>";
+ return @"$(Markup.escape_text(primary))\n<span font='8'>$(Markup.escape_text(secondary))</span>";
}
}
diff --git a/plugins/openpgp/src/plugin.vala b/plugins/openpgp/src/plugin.vala
index b69f7b7a..a585b206 100644
--- a/plugins/openpgp/src/plugin.vala
+++ b/plugins/openpgp/src/plugin.vala
@@ -2,6 +2,9 @@ using Gee;
using Dino.Entities;
+extern const string GETTEXT_PACKAGE;
+extern const string LOCALE_INSTALL_DIR;
+
namespace Dino.Plugins.OpenPgp {
public class Plugin : Plugins.RootInterface, Object {
@@ -23,6 +26,8 @@ namespace Dino.Plugins.OpenPgp {
app.stream_interaction.module_manager.initialize_account_modules.connect(on_initialize_account_modules);
Manager.start(app.stream_interaction, db);
+
+ internationalize(GETTEXT_PACKAGE, app.search_path_generator.get_locale_path(GETTEXT_PACKAGE, LOCALE_INSTALL_DIR));
}
public void shutdown() { }