aboutsummaryrefslogtreecommitdiff
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
parentd8881c4b16a1cd376dd69304c44444aee581da32 (diff)
downloaddino-9bc83539d124f9645dc92e9e39001cb0192dae61.tar.gz
dino-9bc83539d124f9645dc92e9e39001cb0192dae61.zip
Gettext support
-rw-r--r--CMakeLists.txt1
-rw-r--r--cmake/FindGettext.cmake18
-rw-r--r--cmake/UseGettext.cmake28
-rw-r--r--libdino/CMakeLists.txt12
-rw-r--r--libdino/src/application.vala1
-rw-r--r--libdino/src/dino_i18n.h8
-rw-r--r--libdino/src/util.vala37
-rw-r--r--main/CMakeLists.txt11
-rw-r--r--main/data/add_conversation/add_contact_dialog.ui10
-rw-r--r--main/data/add_conversation/add_groupchat_dialog.ui12
-rw-r--r--main/data/add_conversation/conference_details_fragment.ui6
-rw-r--r--main/data/manage_accounts/add_account_dialog.ui6
-rw-r--r--main/data/manage_accounts/dialog.ui8
-rw-r--r--main/data/menu_app.ui6
-rw-r--r--main/data/settings_dialog.ui6
-rw-r--r--main/po/LINGUAS2
-rw-r--r--main/po/POTFILES.in20
-rw-r--r--main/po/de.po196
-rw-r--r--main/po/dino.pot205
-rw-r--r--main/po/en.po9
-rw-r--r--main/src/main.vala10
-rw-r--r--main/src/ui/add_conversation/chat/dialog.vala6
-rw-r--r--main/src/ui/add_conversation/conference/add_groupchat_dialog.vala4
-rw-r--r--main/src/ui/add_conversation/conference/dialog.vala8
-rw-r--r--main/src/ui/conversation_summary/message_item.vala2
-rw-r--r--main/src/ui/conversation_summary/view.vala4
-rw-r--r--main/src/ui/manage_accounts/add_account_dialog.vala2
-rw-r--r--main/src/ui/manage_accounts/dialog.vala18
-rw-r--r--main/src/ui/notifications.vala6
-rw-r--r--main/src/ui/occupant_menu/view.vala2
-rw-r--r--main/src/ui/unified_window.vala10
-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
47 files changed, 780 insertions, 75 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 449598ec..e6458065 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,6 +36,7 @@ set_path(DESKTOP_FILE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications" "Instal
set_path(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "Installation directory for icons")
set_path(INCLUDE_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/include" "Installation directory for C header files")
set_path(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/${LIBDIR_NAME}" "Installation directory for object code libraries")
+set_path(LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale" "Installation directory for locale files")
set_path(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/dino/plugins" "Installation directory for dino plugin object code files")
set_path(VAPI_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/vala/vapi" "Installation directory for Vala API files")
diff --git a/cmake/FindGettext.cmake b/cmake/FindGettext.cmake
new file mode 100644
index 00000000..7d2d260c
--- /dev/null
+++ b/cmake/FindGettext.cmake
@@ -0,0 +1,18 @@
+find_program(XGETTEXT_EXECUTABLE xgettext)
+find_program(MSGMERGE_EXECUTABLE msgmerge)
+find_program(MSGFMT_EXECUTABLE msgfmt)
+find_program(MSGCAT_EXECUTABLE msgcat)
+
+if(XGETTEXT_EXECUTABLE)
+ execute_process(COMMAND ${XGETTEXT_EXECUTABLE} "--version"
+ OUTPUT_VARIABLE GETTEXT_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX REPLACE "xgettext \\(GNU gettext-tools\\) ([0-9\\.]*).*" "\\1" GETTEXT_VERSION "${GETTEXT_VERSION}")
+endif(XGETTEXT_EXECUTABLE)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Gettext
+ REQUIRED_VARS XGETTEXT_EXECUTABLE MSGMERGE_EXECUTABLE MSGFMT_EXECUTABLE MSGCAT_EXECUTABLE
+ VERSION_VAR GETTEXT_VERSION)
+
+set(GETTEXT_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseGettext.cmake") \ No newline at end of file
diff --git a/cmake/UseGettext.cmake b/cmake/UseGettext.cmake
new file mode 100644
index 00000000..3abf418e
--- /dev/null
+++ b/cmake/UseGettext.cmake
@@ -0,0 +1,28 @@
+function(_gettext_mkdir_for_file file)
+ get_filename_component(dir "${file}" DIRECTORY)
+ file(MAKE_DIRECTORY "${dir}")
+endfunction()
+
+function(gettext_compile project_name)
+ cmake_parse_arguments(ARGS "" "MO_FILES_NAME;TARGET_NAME;SOURCE_DIR;PROJECT_NAME" "" ${ARGN})
+
+ if(NOT ARGS_SOURCE_DIR)
+ set(ARGS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+ endif(NOT ARGS_SOURCE_DIR)
+ file(STRINGS "${ARGS_SOURCE_DIR}/LINGUAS" LINGUAS)
+ set(target_files)
+ foreach(lang ${LINGUAS})
+ set(source_file ${ARGS_SOURCE_DIR}/${lang}.po)
+ set(target_file ${CMAKE_BINARY_DIR}/locale/${lang}/LC_MESSAGES/${project_name}.mo)
+ _gettext_mkdir_for_file(${target_file})
+ list(APPEND target_files ${target_file})
+ add_custom_command(OUTPUT ${target_file} COMMAND ${MSGFMT_EXECUTABLE} -o ${target_file} ${source_file} DEPENDS ${source_file})
+ install(FILES ${target_file} DESTINATION ${LOCALE_INSTALL_DIR}/${lang}/LC_MESSAGES)
+ endforeach(lang)
+ if(ARGS_MO_FILES_NAME)
+ set(${ARGS_MO_FILES_NAME} ${target_files} PARENT_SCOPE)
+ endif(ARGS_MO_FILES_NAME)
+ if(ARGS_TARGET_NAME)
+ add_custom_target(${ARGS_TARGET_NAME} DEPENDS ${target_files})
+ endif(ARGS_TARGET_NAME)
+endfunction(gettext_compile) \ No newline at end of file
diff --git a/libdino/CMakeLists.txt b/libdino/CMakeLists.txt
index 0d1a9bf4..445f428a 100644
--- a/libdino/CMakeLists.txt
+++ b/libdino/CMakeLists.txt
@@ -42,6 +42,7 @@ SOURCES
src/service/util.vala
src/settings.vala
+ src/util.vala
CUSTOM_VAPIS
"${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi"
"${CMAKE_BINARY_DIR}/exports/qlite.vapi"
@@ -56,8 +57,17 @@ GENERATE_HEADER
dino
)
+add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/exports/dino_i18n.h"
+COMMAND
+ cp "${CMAKE_CURRENT_SOURCE_DIR}/src/dino_i18n.h" "${CMAKE_BINARY_DIR}/exports/dino_i18n.h"
+DEPENDS
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/dino_i18n.h"
+COMMENT
+ Copy header file dino_i18n.h
+)
+
add_definitions(${VALA_CFLAGS} -DDINO_PLUGINS_SYSTEM_PLUGIN_DIR="${PLUGIN_INSTALL_DIR}" -DDINO_PLUGINS_SYSTEM_LIBDIR_NAME="${LIBDIR_NAME}")
-add_library(libdino SHARED ${LIBDINO_VALA_C})
+add_library(libdino SHARED ${LIBDINO_VALA_C} ${CMAKE_BINARY_DIR}/exports/dino_i18n.h)
add_dependencies(libdino xmpp-vala-vapi qlite-vapi)
target_link_libraries(libdino xmpp-vala qlite ${LIBDINO_PACKAGES} m)
set_target_properties(libdino PROPERTIES PREFIX "" VERSION 0.0 SOVERSION 0)
diff --git a/libdino/src/application.vala b/libdino/src/application.vala
index 37fbda8b..1ce0bca4 100644
--- a/libdino/src/application.vala
+++ b/libdino/src/application.vala
@@ -7,6 +7,7 @@ public class Dino.Application : Gtk.Application {
public Database db;
public StreamInteractor stream_interaction;
public Plugins.Registry plugin_registry = new Plugins.Registry();
+ public SearchPathGenerator? search_path_generator { get; set; }
static string print_xmpp;
diff --git a/libdino/src/dino_i18n.h b/libdino/src/dino_i18n.h
new file mode 100644
index 00000000..e1a65f41
--- /dev/null
+++ b/libdino/src/dino_i18n.h
@@ -0,0 +1,8 @@
+#ifndef __DINO_I18N_H__
+#define __DINO_I18N_H__
+
+#include<libintl.h>
+
+#define dino_gettext(String) ((char *) dgettext (GETTEXT_PACKAGE, String))
+
+#endif \ No newline at end of file
diff --git a/libdino/src/util.vala b/libdino/src/util.vala
new file mode 100644
index 00000000..29186aa0
--- /dev/null
+++ b/libdino/src/util.vala
@@ -0,0 +1,37 @@
+namespace Dino {
+
+public class SearchPathGenerator {
+
+ public string? exec_path { get; private set; }
+
+ public SearchPathGenerator(string? exec_path) {
+ this.exec_path = exec_path;
+ }
+
+ public string get_locale_path(string gettext_package, string locale_install_dir) {
+ string? locale_dir = null;
+ if (Path.get_dirname(exec_path).contains("dino") || Path.get_dirname(exec_path) == "." || Path.get_dirname(exec_path).contains("build")) {
+ string exec_locale = Path.build_filename(Path.get_dirname(exec_path), "locale");
+ if (FileUtils.test(Path.build_filename(exec_locale, "en", "LC_MESSAGES", gettext_package + ".mo"), FileTest.IS_REGULAR)) {
+ locale_dir = exec_locale;
+ }
+ }
+ return locale_dir ?? locale_install_dir;
+ }
+}
+
+[CCode (cname = "dino_gettext", cheader_filename = "dino_i18n.h")]
+public static extern unowned string _(string s);
+
+[CCode (cname = "bindtextdomain", cheader_filename = "libintl.h")]
+private static extern unowned string? bindtextdomain(string domainname, string? dirname);
+
+[CCode (cname = "bind_textdomain_codeset", cheader_filename = "libintl.h")]
+private static extern unowned string? bind_textdomain_codeset(string domainname, string? codeset);
+
+public static void internationalize(string gettext_package, string locales_dir) {
+ Intl.bind_textdomain_codeset(gettext_package, "UTF-8");
+ Intl.bindtextdomain(gettext_package, locales_dir);
+}
+
+} \ No newline at end of file
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index 66362fbe..bada486c 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -1,3 +1,8 @@
+set(GETTEXT_PACKAGE "dino")
+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(MAIN_PACKAGES REQUIRED
Gee
GLib>=2.38
@@ -106,9 +111,9 @@ GRESOURCES
${MAIN_GRESOURCES_XML}
)
-add_definitions(${VALA_CFLAGS})
+add_definitions(${VALA_CFLAGS} -DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DLOCALE_INSTALL_DIR=\"${LOCALE_INSTALL_DIR}\")
add_executable(dino ${MAIN_VALA_C} ${MAIN_GRESOURCES_TARGET})
-add_dependencies(dino dino-vapi dino-gsettings-schema-compiled)
+add_dependencies(dino dino-vapi dino-gsettings-schema-compiled ${GETTEXT_PACKAGE}-translations)
target_link_libraries(dino libdino ${MAIN_PACKAGES})
if(WIN32)
@@ -129,4 +134,4 @@ install(FILES
data/icons/dino-tick-symbolic.svg
DESTINATION
${ICON_INSTALL_DIR}/hicolor/scalable/status
-)
+) \ No newline at end of file
diff --git a/main/data/add_conversation/add_contact_dialog.ui b/main/data/add_conversation/add_contact_dialog.ui
index 533591f5..3e99b2cc 100644
--- a/main/data/add_conversation/add_contact_dialog.ui
+++ b/main/data/add_conversation/add_contact_dialog.ui
@@ -8,7 +8,7 @@
<property name="visible">True</property>
<child>
<object class="GtkButton" id="cancel_button">
- <property name="label">Cancel</property>
+ <property name="label" translatable="yes">Cancel</property>
<property name="sensitive">True</property>
<property name="visible">True</property>
</object>
@@ -20,7 +20,7 @@
<object class="GtkButton" id="ok_button">
<property name="has_default">True</property>
<property name="can_default">True</property>
- <property name="label">Add</property>
+ <property name="label" translatable="yes">Add</property>
<property name="sensitive">False</property>
<property name="visible">True</property>
<style>
@@ -45,7 +45,7 @@
<property name="visible">True</property>
<child>
<object class="GtkLabel">
- <property name="label">Account</property>
+ <property name="label" translatable="yes">Account</property>
<property name="xalign">1</property>
<property name="visible">True</property>
</object>
@@ -98,7 +98,7 @@
</child>
<child>
<object class="GtkLabel">
- <property name="label">Alias</property>
+ <property name="label" translatable="yes">Alias</property>
<property name="xalign">1</property>
<property name="visible">True</property>
</object>
@@ -126,7 +126,7 @@
<child>
<object class="GtkCheckButton" id="subscribe_checkbutton">
<property name="active">True</property>
- <property name="label">Request presence updates</property>
+ <property name="label" translatable="yes">Request presence updates</property>
<property name="xalign">0</property>
<property name="visible">True</property>
</object>
diff --git a/main/data/add_conversation/add_groupchat_dialog.ui b/main/data/add_conversation/add_groupchat_dialog.ui
index 6654e23b..1a027200 100644
--- a/main/data/add_conversation/add_groupchat_dialog.ui
+++ b/main/data/add_conversation/add_groupchat_dialog.ui
@@ -8,7 +8,7 @@
<property name="visible">True</property>
<child>
<object class="GtkButton" id="cancel_button">
- <property name="label">Cancel</property>
+ <property name="label" translatable="yes">Cancel</property>
<property name="sensitive">True</property>
<property name="visible">True</property>
</object>
@@ -46,7 +46,7 @@
<property name="visible">True</property>
<child>
<object class="GtkLabel">
- <property name="label">Account</property>
+ <property name="label" translatable="yes">Account</property>
<property name="xalign">1</property>
<property name="visible">True</property>
</object>
@@ -117,7 +117,7 @@
</child>
<child>
<object class="GtkLabel">
- <property name="label">Nick</property>
+ <property name="label" translatable="yes">Nick</property>
<property name="xalign">1</property>
<property name="visible">True</property>
</object>
@@ -144,7 +144,7 @@
</child>
<child>
<object class="GtkLabel">
- <property name="label">Password</property>
+ <property name="label" translatable="yes">Password</property>
<property name="xalign">1</property>
<property name="visible">True</property>
</object>
@@ -173,7 +173,7 @@
<child>
<object class="GtkCheckButton" id="autojoin_checkbutton">
<property name="active">False</property>
- <property name="label">Join on startup</property>
+ <property name="label" translatable="yes">Join on startup</property>
<property name="xalign">0</property>
<property name="visible">True</property>
</object>
@@ -186,7 +186,7 @@
</child>
<child>
<object class="GtkLabel" id="alias_label">
- <property name="label">Alias</property>
+ <property name="label" translatable="yes">Alias</property>
<property name="xalign">1</property>
<property name="visible">True</property>
</object>
diff --git a/main/data/add_conversation/conference_details_fragment.ui b/main/data/add_conversation/conference_details_fragment.ui
index 41cbb6c7..3218e27e 100644
--- a/main/data/add_conversation/conference_details_fragment.ui
+++ b/main/data/add_conversation/conference_details_fragment.ui
@@ -13,7 +13,7 @@
<property name="visible">True</property>
<child>
<object class="GtkLabel">
- <property name="label">Account</property>
+ <property name="label" translatable="yes">Account</property>
<property name="xalign">1</property>
<property name="visible">True</property>
<style>
@@ -117,7 +117,7 @@
</child>
<child>
<object class="GtkLabel">
- <property name="label">Nick</property>
+ <property name="label" translatable="yes">Nick</property>
<property name="xalign">1</property>
<property name="visible">True</property>
<style>
@@ -169,7 +169,7 @@
</child>
<child>
<object class="GtkLabel">
- <property name="label">Password</property>
+ <property name="label" translatable="yes">Password</property>
<property name="xalign">1</property>
<property name="visible">True</property>
<style>
diff --git a/main/data/manage_accounts/add_account_dialog.ui b/main/data/manage_accounts/add_account_dialog.ui
index c38f624a..10a66bde 100644
--- a/main/data/manage_accounts/add_account_dialog.ui
+++ b/main/data/manage_accounts/add_account_dialog.ui
@@ -18,7 +18,7 @@
<child>
<object class="GtkButton" id="ok_button">
<property name="can_default">True</property>
- <property name="label">Save</property>
+ <property name="label" translatable="yes">Save</property>
<property name="sensitive">False</property>
<property name="visible">True</property>
<style>
@@ -70,7 +70,7 @@
</child>
<child>
<object class="GtkLabel">
- <property name="label">Password</property>
+ <property name="label" translatable="yes">Password</property>
<property name="xalign">1</property>
<property name="visible">True</property>
</object>
@@ -99,7 +99,7 @@
</child>
<child>
<object class="GtkLabel">
- <property name="label">Local alias</property>
+ <property name="label" translatable="yes">Local alias</property>
<property name="xalign">1</property>
<property name="visible">True</property>
</object>
diff --git a/main/data/manage_accounts/dialog.ui b/main/data/manage_accounts/dialog.ui
index 886382e7..fcfe42ca 100644
--- a/main/data/manage_accounts/dialog.ui
+++ b/main/data/manage_accounts/dialog.ui
@@ -6,7 +6,7 @@
<property name="visible">True</property>
<child type="titlebar">
<object class="GtkHeaderBar">
- <property name="title">Accounts</property>
+ <property name="title" translatable="yes">Accounts</property>
<property name="show_close_button">True</property>
<property name="visible">True</property>
</object>
@@ -160,7 +160,7 @@
</child>
<child>
<object class="GtkLabel">
- <property name="label">Password</property>
+ <property name="label" translatable="yes">Password</property>
<property name="xalign">1</property>
<property name="visible">True</property>
<style>
@@ -214,7 +214,7 @@
</child>
<child>
<object class="GtkLabel">
- <property name="label">Local alias</property>
+ <property name="label" translatable="yes">Local alias</property>
<property name="xalign">1</property>
<property name="visible">True</property>
<style>
@@ -303,7 +303,7 @@
</child>
<child>
<object class="GtkButton" id="no_accounts_add">
- <property name="label">Add an account</property>
+ <property name="label" translatable="yes">Add an account</property>
<property name="halign">center</property>
<property name="visible">True</property>
<style>
diff --git a/main/data/menu_app.ui b/main/data/menu_app.ui
index d3fa4cb7..beb81f3f 100644
--- a/main/data/menu_app.ui
+++ b/main/data/menu_app.ui
@@ -3,17 +3,17 @@
<section>
<item>
<attribute name="action">app.accounts</attribute>
- <attribute name="label">Accounts</attribute>
+ <attribute name="label" translatable="yes">Accounts</attribute>
</item>
<item>
<attribute name="action">app.settings</attribute>
- <attribute name="label">Settings</attribute>
+ <attribute name="label" translatable="yes">Settings</attribute>
</item>
</section>
<section>
<item>
<attribute name="action">app.quit</attribute>
- <attribute name="label">Quit</attribute>
+ <attribute name="label" translatable="yes">Quit</attribute>
</item>
</section>
</menu>
diff --git a/main/data/settings_dialog.ui b/main/data/settings_dialog.ui
index 51619c29..7233e858 100644
--- a/main/data/settings_dialog.ui
+++ b/main/data/settings_dialog.ui
@@ -5,7 +5,7 @@
<property name="visible">True</property>
<child type="titlebar">
<object class="GtkHeaderBar">
- <property name="title">Preferences</property>
+ <property name="title" translatable="yes">Preferences</property>
<property name="show_close_button">True</property>
<property name="visible">True</property>
</object>
@@ -20,7 +20,7 @@
<property name="visible">True</property>
<child>
<object class="GtkCheckButton" id="marker_checkbutton">
- <property name="label">Send typing notifications and message marker</property>
+ <property name="label" translatable="yes">Send typing notifications and message marker</property>
<property name="visible">True</property>
</object>
<packing>
@@ -32,7 +32,7 @@
</child>
<child>
<object class="GtkCheckButton" id="emoji_checkbutton">
- <property name="label">Convert smileys to emojis</property>
+ <property name="label" translatable="yes">Convert smileys to emojis</property>
<property name="visible">True</property>
</object>
<packing>
diff --git a/main/po/LINGUAS b/main/po/LINGUAS
new file mode 100644
index 00000000..685f65ef
--- /dev/null
+++ b/main/po/LINGUAS
@@ -0,0 +1,2 @@
+de
+en \ No newline at end of file
diff --git a/main/po/POTFILES.in b/main/po/POTFILES.in
new file mode 100644
index 00000000..cf47561b
--- /dev/null
+++ b/main/po/POTFILES.in
@@ -0,0 +1,20 @@
+data/add_conversation/add_contact_dialog.ui
+data/add_conversation/add_groupchat_dialog.ui
+data/add_conversation/conference_details_fragment.ui
+data/conversation_selector/view.ui
+data/manage_accounts/add_account_dialog.ui
+data/manage_accounts/dialog.ui
+data/menu_add.ui
+data/menu_app.ui
+data/menu_conversation.ui
+data/menu_encryption.ui
+data/settings_dialog.ui
+src/ui/add_conversation/conference/add_groupchat_dialog.vala
+src/ui/add_conversation/conference/dialog.vala
+src/ui/conversation_summary/message_item.vala
+src/ui/conversation_summary/view.vala
+src/ui/manage_accounts/add_account_dialog.vala
+src/ui/manage_accounts/dialog.vala
+src/ui/occupant_menu/view.vala
+src/ui/notifications.vala
+src/ui/unified_window.vala \ No newline at end of file
diff --git a/main/po/de.po b/main/po/de.po
new file mode 100644
index 00000000..61690d2a
--- /dev/null
+++ b/main/po/de.po
@@ -0,0 +1,196 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: dino-0.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-04-10 15:10+0200\n"
+"Language: de\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: data/add_conversation/add_contact_dialog.ui:11
+#: data/add_conversation/add_groupchat_dialog.ui:11
+#: src/ui/add_conversation/conference/dialog.vala:15
+#: src/ui/manage_accounts/dialog.vala:151
+msgid "Cancel"
+msgstr "Abbrechen"
+
+#: data/add_conversation/add_contact_dialog.ui:23
+#: src/ui/add_conversation/conference/add_groupchat_dialog.vala:28
+msgid "Add"
+msgstr "Hinzufügen"
+
+#: data/add_conversation/add_contact_dialog.ui:48
+#: data/add_conversation/add_groupchat_dialog.ui:49
+#: data/add_conversation/conference_details_fragment.ui:16
+msgid "Account"
+msgstr "Konto"
+
+#: data/add_conversation/add_contact_dialog.ui:101
+#: data/add_conversation/add_groupchat_dialog.ui:189
+msgid "Alias"
+msgstr "Alias"
+
+#: data/add_conversation/add_contact_dialog.ui:129
+msgid "Request presence updates"
+msgstr "Online-Status erbitten"
+
+#: data/add_conversation/add_groupchat_dialog.ui:120
+#: data/add_conversation/conference_details_fragment.ui:120
+msgid "Nick"
+msgstr "Nick"
+
+#: data/add_conversation/add_groupchat_dialog.ui:147
+#: data/add_conversation/conference_details_fragment.ui:172
+#: data/manage_accounts/add_account_dialog.ui:73
+#: data/manage_accounts/dialog.ui:163
+msgid "Password"
+msgstr "Passwort"
+
+#: data/add_conversation/add_groupchat_dialog.ui:176
+msgid "Join on startup"
+msgstr "Beim Start beitreten"
+
+#: data/conversation_selector/view.ui:16
+msgid "Search"
+msgstr "Suchen"
+
+#: data/manage_accounts/add_account_dialog.ui:21
+#: src/ui/add_conversation/conference/add_groupchat_dialog.vala:42
+msgid "Save"
+msgstr "Speichern"
+
+#: data/manage_accounts/add_account_dialog.ui:102
+#: data/manage_accounts/dialog.ui:217
+msgid "Local alias"
+msgstr "Lokaler Alias"
+
+#: data/manage_accounts/dialog.ui:9 data/menu_app.ui:6
+msgid "Accounts"
+msgstr "Konten"
+
+#: data/manage_accounts/dialog.ui:306
+msgid "Add an account"
+msgstr "Konto hinzufügen"
+
+#: data/menu_add.ui:6
+msgid "Start Chat"
+msgstr "Chat starten"
+
+#: data/menu_add.ui:12 src/ui/add_conversation/conference/dialog.vala:26
+#: src/ui/unified_window.vala:145
+msgid "Join Conference"
+msgstr "Konferenz beitreten"
+
+#: data/menu_app.ui:10
+msgid "Settings"
+msgstr "Einstellungen"
+
+#: data/menu_app.ui:16
+msgid "Quit"
+msgstr "Beenden"
+
+#: data/menu_conversation.ui:5
+msgid "Contact Details"
+msgstr "Kontakt Details"
+
+#: data/menu_encryption.ui:14
+msgid "Unencrypted"
+msgstr "Unverschlüsselt"
+
+#: data/settings_dialog.ui:8
+msgid "Preferences"
+msgstr "Einstellungen"
+
+#: data/settings_dialog.ui:23
+msgid "Send typing notifications and message marker"
+msgstr "Sende Tippbenachrichtigung und Empfangsbestätigung"
+
+#: data/settings_dialog.ui:35
+msgid "Convert smileys to emojis"
+msgstr "Smileys zu Emojis umwandeln"
+
+#: src/ui/add_conversation/conference/dialog.vala:45
+msgid "Next"
+msgstr "Weiter"
+
+#: src/ui/add_conversation/conference/dialog.vala:60
+msgid "Join"
+msgstr "Beitreten"
+
+#: src/ui/conversation_summary/message_item.vala:107
+msgid "Just now"
+msgstr "Gerade eben"
+
+#: src/ui/conversation_summary/view.vala:120
+msgid "is typing..."
+msgstr "tippt gerade..."
+
+#: src/ui/conversation_summary/view.vala:122
+msgid "has stopped typing"
+msgstr "hat aufgehört zu tippen"
+
+#: src/ui/manage_accounts/add_account_dialog.vala:21
+msgid "Add Account"
+msgstr "Konto hinzufügen"
+
+#: src/ui/manage_accounts/dialog.vala:150
+msgid "Select avatar"
+msgstr "Kontaktbild auswählen"
+
+#: src/ui/manage_accounts/dialog.vala:152
+msgid "Select"
+msgstr "Auswählen"
+
+#: src/ui/manage_accounts/dialog.vala:251
+msgid "Connecting..."
+msgstr "Verbinden..."
+
+#: src/ui/manage_accounts/dialog.vala:253
+msgid "Connected"
+msgstr "Verbunden"
+
+#: src/ui/manage_accounts/dialog.vala:255
+msgid "Disconnected"
+msgstr "Nicht verbunden"
+
+#: src/ui/manage_accounts/dialog.vala:278
+msgid "Wrong password"
+msgstr "Passwort falsch"
+
+#: src/ui/manage_accounts/dialog.vala:281
+#: src/ui/manage_accounts/dialog.vala:283
+msgid "Error"
+msgstr "Fehler"
+
+#: src/ui/occupant_menu/view.vala:48
+msgid "Start private conversation"
+msgstr "Private Konversation beginnen"
+
+#: src/ui/notifications.vala:59
+msgid "Subscription request"
+msgstr "Kontaktanfrage"
+
+#: src/ui/notifications.vala:61
+msgid "Accept"
+msgstr "Annehmen"
+
+#: src/ui/notifications.vala:74
+msgid "Deny"
+msgstr "Ablehnen"
+
+#: src/ui/unified_window.vala:135
+msgid "No accounts active"
+msgstr "Keine Konten aktiv"
+
+#: src/ui/unified_window.vala:136
+msgid "Manage accounts"
+msgstr "Konten verwalten"
+
+#: src/ui/unified_window.vala:143
+msgid "No conversation active"
+msgstr "Keine Konversation aktiv"
+
+#: src/ui/unified_window.vala:144
+msgid "Add Chat"
+msgstr "Chat hinzufügen"
diff --git a/main/po/dino.pot b/main/po/dino.pot
new file mode 100644
index 00000000..620ffeb3
--- /dev/null
+++ b/main/po/dino.pot
@@ -0,0 +1,205 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-04-10 15:10+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: data/add_conversation/add_contact_dialog.ui:11
+#: data/add_conversation/add_groupchat_dialog.ui:11
+#: src/ui/add_conversation/conference/dialog.vala:15
+#: src/ui/manage_accounts/dialog.vala:151
+msgid "Cancel"
+msgstr ""
+
+#: data/add_conversation/add_contact_dialog.ui:23
+#: src/ui/add_conversation/conference/add_groupchat_dialog.vala:28
+msgid "Add"
+msgstr ""
+
+#: data/add_conversation/add_contact_dialog.ui:48
+#: data/add_conversation/add_groupchat_dialog.ui:49
+#: data/add_conversation/conference_details_fragment.ui:16
+msgid "Account"
+msgstr ""
+
+#: data/add_conversation/add_contact_dialog.ui:101
+#: data/add_conversation/add_groupchat_dialog.ui:189
+msgid "Alias"
+msgstr ""
+
+#: data/add_conversation/add_contact_dialog.ui:129
+msgid "Request presence updates"
+msgstr ""
+
+#: data/add_conversation/add_groupchat_dialog.ui:120
+#: data/add_conversation/conference_details_fragment.ui:120
+msgid "Nick"
+msgstr ""
+
+#: data/add_conversation/add_groupchat_dialog.ui:147
+#: data/add_conversation/conference_details_fragment.ui:172
+#: data/manage_accounts/add_account_dialog.ui:73
+#: data/manage_accounts/dialog.ui:163
+msgid "Password"
+msgstr ""
+
+#: data/add_conversation/add_groupchat_dialog.ui:176
+msgid "Join on startup"
+msgstr ""
+
+#: data/conversation_selector/view.ui:16
+msgid "Search"
+msgstr ""
+
+#: data/manage_accounts/add_account_dialog.ui:21
+#: src/ui/add_conversation/conference/add_groupchat_dialog.vala:42
+msgid "Save"
+msgstr ""
+
+#: data/manage_accounts/add_account_dialog.ui:102
+#: data/manage_accounts/dialog.ui:217
+msgid "Local alias"
+msgstr ""
+
+#: data/manage_accounts/dialog.ui:9 data/menu_app.ui:6
+msgid "Accounts"
+msgstr ""
+
+#: data/manage_accounts/dialog.ui:306
+msgid "Add an account"
+msgstr ""
+
+#: data/menu_add.ui:6
+msgid "Start Chat"
+msgstr ""
+
+#: data/menu_add.ui:12 src/ui/add_conversation/conference/dialog.vala:26
+#: src/ui/unified_window.vala:145
+msgid "Join Conference"
+msgstr ""
+
+#: data/menu_app.ui:10
+msgid "Settings"
+msgstr ""
+
+#: data/menu_app.ui:16
+msgid "Quit"
+msgstr ""
+
+#: data/menu_conversation.ui:5
+msgid "Contact Details"
+msgstr ""
+
+#: data/menu_encryption.ui:14
+msgid "Unencrypted"
+msgstr ""
+
+#: data/settings_dialog.ui:8
+msgid "Preferences"
+msgstr ""
+
+#: data/settings_dialog.ui:23
+msgid "Send typing notifications and message marker"
+msgstr ""
+
+#: data/settings_dialog.ui:35
+msgid "Convert smileys to emojis"
+msgstr ""
+
+#: src/ui/add_conversation/conference/dialog.vala:45
+msgid "Next"
+msgstr ""
+
+#: src/ui/add_conversation/conference/dialog.vala:60
+msgid "Join"
+msgstr ""
+
+#: src/ui/conversation_summary/message_item.vala:107
+msgid "Just now"
+msgstr ""
+
+#: src/ui/conversation_summary/view.vala:120
+msgid "is typing..."
+msgstr ""
+
+#: src/ui/conversation_summary/view.vala:122
+msgid "has stopped typing"
+msgstr ""
+
+#: src/ui/manage_accounts/add_account_dialog.vala:21
+msgid "Add Account"
+msgstr ""
+
+#: src/ui/manage_accounts/dialog.vala:150
+msgid "Select avatar"
+msgstr ""
+
+#: src/ui/manage_accounts/dialog.vala:152
+msgid "Select"
+msgstr ""
+
+#: src/ui/manage_accounts/dialog.vala:251
+msgid "Connecting..."
+msgstr ""
+
+#: src/ui/manage_accounts/dialog.vala:253
+msgid "Connected"
+msgstr ""
+
+#: src/ui/manage_accounts/dialog.vala:255
+msgid "Disconnected"
+msgstr ""
+
+#: src/ui/manage_accounts/dialog.vala:278
+msgid "Wrong password"
+msgstr ""
+
+#: src/ui/manage_accounts/dialog.vala:281
+#: src/ui/manage_accounts/dialog.vala:283
+msgid "Error"
+msgstr ""
+
+#: src/ui/occupant_menu/view.vala:48
+msgid "Start private conversation"
+msgstr ""
+
+#: src/ui/notifications.vala:59
+msgid "Subscription request"
+msgstr ""
+
+#: src/ui/notifications.vala:61
+msgid "Accept"
+msgstr ""
+
+#: src/ui/notifications.vala:74
+msgid "Deny"
+msgstr ""
+
+#: src/ui/unified_window.vala:135
+msgid "No accounts active"
+msgstr ""
+
+#: src/ui/unified_window.vala:136
+msgid "Manage accounts"
+msgstr ""
+
+#: src/ui/unified_window.vala:143
+msgid "No conversation active"
+msgstr ""
+
+#: src/ui/unified_window.vala:144
+msgid "Add Chat"
+msgstr ""
diff --git a/main/po/en.po b/main/po/en.po
new file mode 100644
index 00000000..0f223e2b
--- /dev/null
+++ b/main/po/en.po
@@ -0,0 +1,9 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: dino-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/main/src/main.vala b/main/src/main.vala
index 14029e47..e0d54d18 100644
--- a/main/src/main.vala
+++ b/main/src/main.vala
@@ -1,20 +1,28 @@
using Dino.Entities;
using Dino.Ui;
+extern const string GETTEXT_PACKAGE;
+extern const string LOCALE_INSTALL_DIR;
+
namespace Dino {
void main(string[] args) {
+
try{
string? exec_path = args.length > 0 ? args[0] : null;
+ SearchPathGenerator search_path_generator = new SearchPathGenerator(exec_path);
if (exec_path != null && exec_path.contains(Path.DIR_SEPARATOR_S)) {
string bindir = Path.get_dirname(exec_path);
if (FileUtils.test(Path.build_filename(bindir, "gschemas.compiled"), FileTest.IS_REGULAR)) {
Environment.set_variable("GSETTINGS_SCHEMA_DIR", Path.get_dirname(exec_path), false);
}
}
+ Intl.textdomain(GETTEXT_PACKAGE);
+ internationalize(GETTEXT_PACKAGE, search_path_generator.get_locale_path(GETTEXT_PACKAGE, LOCALE_INSTALL_DIR));
+
Plugins.Loader loader = new Plugins.Loader(exec_path);
Gtk.init(ref args);
- Dino.Ui.Application app = new Dino.Ui.Application();
+ Dino.Ui.Application app = new Dino.Ui.Application() { search_path_generator=search_path_generator };
app.add_main_option("plugin-paths", 0, 0, OptionArg.NONE, "Display plugin search paths and exit", null);
app.handle_local_options.connect((options) => {
diff --git a/main/src/ui/add_conversation/chat/dialog.vala b/main/src/ui/add_conversation/chat/dialog.vala
index 910e7264..6873b4ca 100644
--- a/main/src/ui/add_conversation/chat/dialog.vala
+++ b/main/src/ui/add_conversation/chat/dialog.vala
@@ -18,7 +18,7 @@ public class Dialog : Gtk.Dialog {
public Dialog(StreamInteractor stream_interactor) {
Object(use_header_bar : 1);
- this.title = "Start Chat";
+ this.title = _("Start Chat");
this.modal = true;
this.stream_interactor = stream_interactor;
@@ -31,13 +31,13 @@ public class Dialog : Gtk.Dialog {
header_bar.show_close_button = false;
Button cancel_button = new Button();
- cancel_button.set_label("Cancel");
+ cancel_button.set_label(_("Cancel"));
cancel_button.visible = true;
header_bar.pack_start(cancel_button);
ok_button = new Button();
ok_button.get_style_context().add_class("suggested-action");
- ok_button.label = "Start";
+ ok_button.label = _("Start");
ok_button.sensitive = false;
ok_button.visible = true;
header_bar.pack_end(ok_button);
diff --git a/main/src/ui/add_conversation/conference/add_groupchat_dialog.vala b/main/src/ui/add_conversation/conference/add_groupchat_dialog.vala
index 96d44000..10c91c70 100644
--- a/main/src/ui/add_conversation/conference/add_groupchat_dialog.vala
+++ b/main/src/ui/add_conversation/conference/add_groupchat_dialog.vala
@@ -25,7 +25,7 @@ protected class AddGroupchatDialog : Gtk.Dialog {
public AddGroupchatDialog(StreamInteractor stream_interactor) {
Object(use_header_bar : 1);
this.stream_interactor = stream_interactor;
- ok_button.label = "Add";
+ ok_button.label = _("Add");
ok_button.get_style_context().add_class("suggested-action"); // TODO why doesn't it work in XML
accounts_stack.set_visible_child_name("combobox");
account_combobox.initialize(stream_interactor);
@@ -39,7 +39,7 @@ protected class AddGroupchatDialog : Gtk.Dialog {
public AddGroupchatDialog.for_conference(StreamInteractor stream_interactor, Account account, Xmpp.Xep.Bookmarks.Conference conference) {
this(stream_interactor);
edit_confrence = conference;
- ok_button.label = "Save";
+ ok_button.label = _("Save");
ok_button.sensitive = true;
accounts_stack.set_visible_child_name("label");
account_label.label = account.bare_jid.to_string();
diff --git a/main/src/ui/add_conversation/conference/dialog.vala b/main/src/ui/add_conversation/conference/dialog.vala
index c035c11d..2da37c08 100644
--- a/main/src/ui/add_conversation/conference/dialog.vala
+++ b/main/src/ui/add_conversation/conference/dialog.vala
@@ -12,7 +12,7 @@ public class Dialog : Gtk.Dialog {
private Stack stack = new Stack();
private Button cancel_button;
private Button ok_button;
- private Label cancel_label = new Label("Cancel") {visible=true};
+ private Label cancel_label = new Label(_("Cancel")) {visible=true};
private Image cancel_image = new Image.from_icon_name("go-previous-symbolic", IconSize.MENU) {visible=true};
private SelectJidFragment select_fragment;
@@ -23,7 +23,7 @@ public class Dialog : Gtk.Dialog {
public Dialog(StreamInteractor stream_interactor) {
Object(use_header_bar : 1);
- this.title = "Join Conference";
+ this.title = _("Join Conference");
this.modal = true;
this.stream_interactor = stream_interactor;
@@ -42,7 +42,7 @@ public class Dialog : Gtk.Dialog {
cancel_button.add(cancel_label);
cancel_button.clicked.disconnect(show_jid_add_view);
cancel_button.clicked.connect(on_cancel);
- ok_button.label = "Next";
+ ok_button.label = _("Next");
ok_button.sensitive = select_fragment.done;
ok_button.clicked.disconnect(on_ok_button_clicked);
ok_button.clicked.connect(on_next_button_clicked);
@@ -57,7 +57,7 @@ public class Dialog : Gtk.Dialog {
cancel_button.add(cancel_image);
cancel_button.clicked.disconnect(on_cancel);
cancel_button.clicked.connect(show_jid_add_view);
- ok_button.label = "Join";
+ ok_button.label = _("Join");
ok_button.sensitive = details_fragment.done;
ok_button.clicked.disconnect(on_next_button_clicked);
ok_button.clicked.connect(on_ok_button_clicked);
diff --git a/main/src/ui/conversation_summary/message_item.vala b/main/src/ui/conversation_summary/message_item.vala
index fed67945..4b26a289 100644
--- a/main/src/ui/conversation_summary/message_item.vala
+++ b/main/src/ui/conversation_summary/message_item.vala
@@ -104,7 +104,7 @@ public class MessageItem : Grid, ConversationItem {
} else if (timespan > TimeSpan.MINUTE) {
return (timespan / TimeSpan.MINUTE).to_string() + " min ago";
} else {
- return "Just now";
+ return _("Just now");
}
}
}
diff --git a/main/src/ui/conversation_summary/view.vala b/main/src/ui/conversation_summary/view.vala
index 179c14e3..60d26cf0 100644
--- a/main/src/ui/conversation_summary/view.vala
+++ b/main/src/ui/conversation_summary/view.vala
@@ -117,9 +117,9 @@ public class View : Box {
if (state_ != null) {
if (state_ == Xep.ChatStateNotifications.STATE_COMPOSING || state_ == Xep.ChatStateNotifications.STATE_PAUSED) {
if (state_ == Xep.ChatStateNotifications.STATE_COMPOSING) {
- typing_status = new StatusItem(stream_interactor, conversation, "is typing...");
+ typing_status = new StatusItem(stream_interactor, conversation, _("is typing..."));
} else if (state_ == Xep.ChatStateNotifications.STATE_PAUSED) {
- typing_status = new StatusItem(stream_interactor, conversation, "has stoped typing");
+ typing_status = new StatusItem(stream_interactor, conversation, _("has stopped typing"));
}
main.add(typing_status);
}
diff --git a/main/src/ui/manage_accounts/add_account_dialog.vala b/main/src/ui/manage_accounts/add_account_dialog.vala
index 8501f476..74754b79 100644
--- a/main/src/ui/manage_accounts/add_account_dialog.vala
+++ b/main/src/ui/manage_accounts/add_account_dialog.vala
@@ -18,7 +18,7 @@ public class AddAccountDialog : Gtk.Dialog {
public AddAccountDialog(StreamInteractor stream_interactor) {
Object(use_header_bar : 1);
- this.title = "Add Account";
+ this.title = _("Add Account");
cancel_button.clicked.connect(() => { close(); });
ok_button.clicked.connect(on_ok_button_clicked);
diff --git a/main/src/ui/manage_accounts/dialog.vala b/main/src/ui/manage_accounts/dialog.vala
index e8697bad..24a8b47c 100644
--- a/main/src/ui/manage_accounts/dialog.vala
+++ b/main/src/ui/manage_accounts/dialog.vala
@@ -147,9 +147,9 @@ public class Dialog : Gtk.Window {
private void on_image_button_clicked() {
FileChooserDialog chooser = new FileChooserDialog (
- "Select avatar", this, FileChooserAction.OPEN,
- "Cancel", ResponseType.CANCEL,
- "Select", ResponseType.ACCEPT);
+ _("Select avatar"), this, FileChooserAction.OPEN,
+ _("Cancel"), ResponseType.CANCEL,
+ _("Select"), ResponseType.ACCEPT);
FileFilter filter = new FileFilter();
filter.add_mime_type("image/*");
chooser.set_filter(filter);
@@ -248,11 +248,11 @@ public class Dialog : Gtk.Window {
ConnectionManager.ConnectionState state = stream_interactor.connection_manager.get_state(account);
switch (state) {
case ConnectionManager.ConnectionState.CONNECTING:
- state_label.label = "Connecting..."; break;
+ state_label.label = _("Connecting..."); break;
case ConnectionManager.ConnectionState.CONNECTED:
- state_label.label = "Connected"; break;
+ state_label.label = _("Connected"); break;
case ConnectionManager.ConnectionState.DISCONNECTED:
- state_label.label = "Disconnected"; break;
+ state_label.label = _("Disconnected"); break;
}
state_label.get_style_context().remove_class("is_error");
}
@@ -275,12 +275,12 @@ public class Dialog : Gtk.Window {
private string get_connection_error_description(ConnectionManager.ConnectionError error) {
switch (error.source) {
case ConnectionManager.ConnectionError.Source.SASL:
- return "Wrong password";
+ return _("Wrong password");
}
if (error.identifier != null) {
- return "Error" + ": " + error.identifier;
+ return _("Error") + ": " + error.identifier;
} else {
- return "Error";
+ return _("Error");
}
}
}
diff --git a/main/src/ui/notifications.vala b/main/src/ui/notifications.vala
index 3846c7ba..029a4b33 100644
--- a/main/src/ui/notifications.vala
+++ b/main/src/ui/notifications.vala
@@ -56,9 +56,9 @@ public class Notifications : Object {
}
private void on_received_subscription_request(Jid jid, Account account) {
- Notify.Notification notification = new Notify.Notification("Subscription request", jid.bare_jid.to_string(), null);
+ Notify.Notification notification = new Notify.Notification(_("Subscription request"), jid.bare_jid.to_string(), null);
notification.set_image_from_pixbuf((new AvatarGenerator(40, 40)).draw_jid(stream_interactor, jid, account));
- notification.add_action("accept", "Accept", () => {
+ notification.add_action("accept", _("Accept"), () => {
stream_interactor.get_module(PresenceManager.IDENTITY).approve_subscription(account, jid);
if (stream_interactor.get_module(RosterManager.IDENTITY).get_roster_item(account, jid) == null) {
@@ -71,7 +71,7 @@ public class Notifications : Object {
notification.close();
} catch (Error error) { }
});
- notification.add_action("deny", "Deny", () => {
+ notification.add_action("deny", _("Deny"), () => {
stream_interactor.get_module(PresenceManager.IDENTITY).deny_subscription(account, jid);
try {
notification.close();
diff --git a/main/src/ui/occupant_menu/view.vala b/main/src/ui/occupant_menu/view.vala
index b7fe15ba..b6b25961 100644
--- a/main/src/ui/occupant_menu/view.vala
+++ b/main/src/ui/occupant_menu/view.vala
@@ -45,7 +45,7 @@ public class View : Popover {
Button header_button = new Button() { relief=ReliefStyle.NONE, visible=true };
header_button.add(header_box);
- ModelButton private_button = new ModelButton() { active=true, text="Start private conversation", visible=true };
+ ModelButton private_button = new ModelButton() { active=true, text=_("Start private conversation"), visible=true };
Box outer_box = new Box(Orientation.VERTICAL, 5) { margin=10, visible=true };
outer_box.add(header_button);
diff --git a/main/src/ui/unified_window.vala b/main/src/ui/unified_window.vala
index d4d9055c..1c4474c7 100644
--- a/main/src/ui/unified_window.vala
+++ b/main/src/ui/unified_window.vala
@@ -132,17 +132,17 @@ public class UnifiedWindow : Window {
public class NoAccountsPlaceholder : UnifiedWindowPlaceholder {
public NoAccountsPlaceholder() {
- label.label = "No accounts active";
- primary_button.label = "Manage accounts";
+ label.label = _("No accounts active");
+ primary_button.label = _("Manage accounts");
secondary_button.visible = false;
}
}
public class NoConversationsPlaceholder : UnifiedWindowPlaceholder {
public NoConversationsPlaceholder() {
- label.label = "No conversation active";
- primary_button.label = "Add Chat";
- secondary_button.label = "Join Conference";
+ label.label = _("No conversation active");
+ primary_button.label = _("Add Chat");
+ secondary_button.label = _("Join Conference");
secondary_button.visible = true;
}
}
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() { }