From 9bc83539d124f9645dc92e9e39001cb0192dae61 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 7 Apr 2017 11:09:47 +0200 Subject: Gettext support --- plugins/omemo/CMakeLists.txt | 9 +++++++-- plugins/omemo/po/LINGUAS | 2 ++ plugins/omemo/po/POTFILES.in | 1 + plugins/omemo/po/de.po | 22 ++++++++++++++++++++++ plugins/omemo/po/dino-omemo.pot | 22 ++++++++++++++++++++++ plugins/omemo/po/en.po | 9 +++++++++ plugins/omemo/src/account_settings_widget.vala | 6 +++--- plugins/omemo/src/plugin.vala | 5 +++++ 8 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 plugins/omemo/po/LINGUAS create mode 100644 plugins/omemo/po/POTFILES.in create mode 100644 plugins/omemo/po/de.po create mode 100644 plugins/omemo/po/dino-omemo.pot create mode 100644 plugins/omemo/po/en.po (limited to 'plugins/omemo') 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\nWill be generated on first connect"); + fingerprint.set_markup("%s\n%s".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$res"); + fingerprint.set_markup("%s\n%s".printf(_("Own fingerprint"), res)); } } catch (Qlite.DatabaseError e) { - fingerprint.set_markup(@"Own fingerprint\nDatabase error"); + fingerprint.set_markup("%s\n%s".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"); } -- cgit v1.2.3-54-g00ecf