diff options
-rw-r--r-- | CMakeLists.txt | 26 | ||||
-rw-r--r-- | data/i18n/purple-vk-plugin.pot | 213 | ||||
-rw-r--r-- | data/i18n/ru.po | 215 | ||||
-rw-r--r-- | src/common.h | 4 | ||||
-rw-r--r-- | src/vk-plugin.cpp | 10 |
5 files changed, 464 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e3e53fb..2710ca0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8.6) project(purple-vk-plugin) @@ -180,3 +180,27 @@ if(UNIX AND NOT APPLE) install(DIRECTORY "data/protocols" DESTINATION "share/pixmaps/pidgin") install(DIRECTORY "data/smileys/vk" DESTINATION "share/pixmaps/pidgin/emotes") endif() + +# Translations. Supported only on Linux for now. + +if(UNIX) + find_package(Gettext REQUIRED) + + set(POT_FILE data/i18n/${PROJECT_NAME}.pot) + set(PO_FILES + data/i18n/ru.po + ) + + # Add custom target for running xgettext. xgettext runs in almost no time, so add + # add it to ALL target. + set(XGETTEXT_OPTIONS --language=C++ --add-comments=i18n --keyword=i18n --no-location --package-name=${PROJECT_NAME}) + add_custom_command(OUTPUT ${POT_FILE} + COMMAND xgettext ${XGETTEXT_OPTIONS} -o ${POT_FILE} ${SOURCES} + DEPENDS ${SOURCES} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMENT "Extract translatable messages to ${POT_FILE}" + ) + add_custom_target(extractpot ALL DEPENDS ${POT_FILE}) + + gettext_create_translations(${POT_FILE} ALL ${PO_FILES}) +endif() diff --git a/data/i18n/purple-vk-plugin.pot b/data/i18n/purple-vk-plugin.pot new file mode 100644 index 0000000..6c979d1 --- /dev/null +++ b/data/i18n/purple-vk-plugin.pot @@ -0,0 +1,213 @@ +# 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: purple-vk-plugin\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-08-29 13:48+0400\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" + +msgid "Please open https://vk.com in your browser and validate yourself" +msgstr "" + +#, c-format +msgid "" +"Please open the following link in your browser:\n" +"%s" +msgstr "" + +msgid "Please validate yourself" +msgstr "" + +msgid "Ok" +msgstr "" + +msgid "Validate yourself" +msgstr "" + +msgid "Internal server error" +msgstr "" + +msgid "Connecting" +msgstr "" + +msgid "Error retrieving login page" +msgstr "" + +msgid "Internal auth error" +msgstr "" + +msgid "Error retrieving login confirmation page" +msgstr "" + +msgid "Wrong username or password" +msgstr "" + +msgid "Unable to update user infos" +msgstr "" + +msgid "Unable to retrieve buddy list" +msgstr "" + +msgid "Unable to retrieve dialogs list" +msgstr "" + +msgid "Unable retrieve online info" +msgstr "" + +msgid "Unable to retrieve online info" +msgstr "" + +msgid "Unable to retrieve chat info" +msgstr "" + +msgid "Captcha" +msgstr "" + +msgid "Text" +msgstr "" + +msgid "Are you classified as human?" +msgstr "" + +msgid "Cancel" +msgstr "" + +#, c-format +msgid "Unable to add user %s" +msgstr "" + +#, c-format +msgid "Unable to remove user %s" +msgstr "" + +msgid "Unable to set chat title" +msgstr "" + +msgid "Authentication process failed" +msgstr "" + +msgid "Unable to connect to Long Poll server" +msgstr "" + +#, c-format +msgid "Sent file has already been uploaded and is permanently available at %s" +msgstr "" + +#, c-format +msgid "Sent file will be permanently available at %s" +msgstr "" + +msgid "Unable to receive message" +msgstr "" + +msgid "Unknown attachement type " +msgstr "" + +#, c-format +msgid "Forwarded message (from %s on %s):\n" +msgstr "" + +msgid "reposted" +msgstr "" + +msgid "posted" +msgstr "" + +msgid "on" +msgstr "" + +msgid "Album" +msgstr "" + +msgid "Updating data..." +msgstr "" + +msgid "Nickname" +msgstr "" + +msgid "Status" +msgstr "" + +msgid "Uses mobile client" +msgstr "" + +#, c-format +msgid "" +"Unable to find user %s. User name should be either idXXXXXX or nickname (i." +"e. the last part of https://vk.com/nickname)" +msgstr "" + +msgid "title <title>: Set chat title" +msgstr "" + +msgid "add <user>: Add user to chat" +msgstr "" + +msgid "remove <user>: Remove user from chat" +msgstr "" + +msgid "User is not a Vk.com user" +msgstr "" + +msgid "Page" +msgstr "" + +msgid "Name" +msgstr "" + +msgid "Birthdate" +msgstr "" + +msgid "Education" +msgstr "" + +msgid "Mobile phone" +msgstr "" + +msgid "Last seen" +msgstr "" + +msgid "E-mail or telephone" +msgstr "" + +#, c-format +msgid "Unable to find user %s" +msgstr "" + +msgid "" +"User name should be either idXXXXXX or nickname (i.e. the last part of " +"https://vk.com/nickname)" +msgstr "" + +msgid "Show only friends in buddy list" +msgstr "" + +msgid "Show chats in buddy list" +msgstr "" + +msgid "Mark messages as read only when status is Online" +msgstr "" + +msgid "Show this client as mobile client" +msgstr "" + +msgid "Group for buddies" +msgstr "" + +msgid "Group for chats" +msgstr "" + +#, c-format +msgid "%s (you)" +msgstr "" diff --git a/data/i18n/ru.po b/data/i18n/ru.po new file mode 100644 index 0000000..8fa3c0d --- /dev/null +++ b/data/i18n/ru.po @@ -0,0 +1,215 @@ +# Russian translations for purple-vk-plugin package +# Английские переводы для пакета purple-vk-plugin. +# Copyright (C) 2014 THE purple-vk-plugin'S COPYRIGHT HOLDER +# This file is distributed under the same license as the purple-vk-plugin package. +# oleg <OlegOAndreev@yandex.ru>, 2014. +# +msgid "" +msgstr "" +"Project-Id-Version: purple-vk-plugin\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-08-29 13:48+0400\n" +"PO-Revision-Date: 2014-08-29 13:13+0400\n" +"Last-Translator: oleg <OlegOAndreev@yandex.ru>\n" +"Language-Team: Russian\n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" + +#, c-format +msgid "%s (you)" +msgstr "" + +msgid "Album" +msgstr "" + +msgid "Are you classified as human?" +msgstr "" + +msgid "Authentication process failed" +msgstr "" + +msgid "Birthdate" +msgstr "" + +msgid "Cancel" +msgstr "" + +msgid "Captcha" +msgstr "" + +msgid "Connecting" +msgstr "" + +msgid "E-mail or telephone" +msgstr "" + +msgid "Education" +msgstr "" + +msgid "Error retrieving login confirmation page" +msgstr "" + +msgid "Error retrieving login page" +msgstr "" + +#, c-format +msgid "Forwarded message (from %s on %s):\n" +msgstr "" + +msgid "Group for buddies" +msgstr "Группа для пользователей" + +msgid "Group for chats" +msgstr "Группа для бесед" + +msgid "Internal auth error" +msgstr "" + +msgid "Internal server error" +msgstr "" + +msgid "Last seen" +msgstr "" + +msgid "Mark messages as read only when status is Online" +msgstr "Отмечать сообщения как прочитанные только при статусе Доступен" + +msgid "Mobile phone" +msgstr "" + +msgid "Name" +msgstr "" + +msgid "Nickname" +msgstr "" + +msgid "Ok" +msgstr "" + +msgid "Page" +msgstr "" + +msgid "Please open https://vk.com in your browser and validate yourself" +msgstr "" + +#, c-format +msgid "" +"Please open the following link in your browser:\n" +"%s" +msgstr "" + +msgid "Please validate yourself" +msgstr "" + +#, c-format +msgid "Sent file has already been uploaded and is permanently available at %s" +msgstr "" + +#, c-format +msgid "Sent file will be permanently available at %s" +msgstr "" + +msgid "Show chats in buddy list" +msgstr "Показывать в контакт-листе беседы" + +msgid "Show only friends in buddy list" +msgstr "Показывать в контакт-листе только друзей" + +msgid "Show this client as mobile client" +msgstr "Показывать данный клиент как мобильный" + +msgid "Status" +msgstr "" + +msgid "Text" +msgstr "" + +msgid "Unable retrieve online info" +msgstr "" + +#, c-format +msgid "Unable to add user %s" +msgstr "" + +msgid "Unable to connect to Long Poll server" +msgstr "" + +#, c-format +msgid "Unable to find user %s" +msgstr "" + +#, c-format +msgid "" +"Unable to find user %s. User name should be either idXXXXXX or nickname (i." +"e. the last part of https://vk.com/nickname)" +msgstr "" + +msgid "Unable to receive message" +msgstr "" + +#, c-format +msgid "Unable to remove user %s" +msgstr "" + +msgid "Unable to retrieve buddy list" +msgstr "" + +msgid "Unable to retrieve chat info" +msgstr "" + +msgid "Unable to retrieve dialogs list" +msgstr "" + +msgid "Unable to retrieve online info" +msgstr "" + +msgid "Unable to set chat title" +msgstr "" + +msgid "Unable to update user infos" +msgstr "" + +msgid "Unknown attachement type " +msgstr "" + +msgid "Updating data..." +msgstr "" + +msgid "User is not a Vk.com user" +msgstr "" + +msgid "" +"User name should be either idXXXXXX or nickname (i.e. the last part of " +"https://vk.com/nickname)" +msgstr "" + +msgid "Uses mobile client" +msgstr "" + +msgid "Validate yourself" +msgstr "" + +msgid "Wrong username or password" +msgstr "" + +msgid "add <user>: Add user to chat" +msgstr "" + +msgid "on" +msgstr "" + +msgid "posted" +msgstr "" + +msgid "remove <user>: Remove user from chat" +msgstr "" + +msgid "reposted" +msgstr "" + +msgid "title <title>: Set chat title" +msgstr "" diff --git a/src/common.h b/src/common.h index eed5cdc..9dc5538 100644 --- a/src/common.h +++ b/src/common.h @@ -11,10 +11,12 @@ #include <chrono> #include <cstdio> #include <functional> +#include <libintl.h> #include <memory> #include <string> #include <vector> + // Let's make using most popular names easier. using std::shared_ptr; using std::vector; @@ -157,7 +159,7 @@ std::chrono::seconds::rep to_seconds(T duration) // I18n -#define i18n(x) (x) +#define i18n(x) dgettext("purple-vk-plugin", x) // Debugging macros diff --git a/src/vk-plugin.cpp b/src/vk-plugin.cpp index 332f5f1..993e7da 100644 --- a/src/vk-plugin.cpp +++ b/src/vk-plugin.cpp @@ -824,6 +824,12 @@ PurplePluginInfo info = { void vkcom_prpl_init(PurplePlugin*) { + // Specify locale path and encoding. + char* locale_path = g_build_filename(get_data_dir().data(), "locale", nullptr); + bindtextdomain("purple-vk-plugin", locale_path); + bind_textdomain_codeset("purple-vk-plugin", "utf-8"); + g_free(locale_path); + // Options, listed on "Advanced" page when creating or modifying account. PurpleAccountOption *option; option = purple_account_option_bool_new(i18n("Show only friends in buddy list"), @@ -834,11 +840,11 @@ void vkcom_prpl_init(PurplePlugin*) "chats_in_blist", true); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(i18n("Do not mark messages as read when away"), + option = purple_account_option_bool_new(i18n("Mark messages as read only when status is Online"), "mark_as_read_online_only", true); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); - option = purple_account_option_bool_new(i18n("Imitate using mobile client"), + option = purple_account_option_bool_new(i18n("Show this client as mobile client"), "imitate_mobile_client", false); prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |