initial code translation preparation, russian localization

This commit is contained in:
Blue 2019-10-05 14:27:39 +03:00
parent 746fdef013
commit 8afdb81314
14 changed files with 781 additions and 75 deletions

View File

@ -1,16 +1,15 @@
cmake_minimum_required(VERSION 3.0)
project(squawk)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
# Instruct CMake to create code from Qt designer ui files
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
find_package(Qt5Widgets CONFIG REQUIRED)
find_package(Qt5LinguistTools)
set(squawk_SRC
main.cpp
global.cpp
@ -18,7 +17,15 @@ set(squawk_SRC
signalcatcher.cpp
)
add_executable(squawk ${squawk_SRC} resources/resources.qrc)
set(TS_FILES
translations/squawk.ru.ts
)
qt5_add_translation(QM_FILES ${TS_FILES})
add_custom_target(translations ALL DEPENDS ${QM_FILES})
qt5_add_resources(RCC resources/resources.qrc)
add_executable(squawk ${squawk_SRC} ${RCC})
target_link_libraries(squawk Qt5::Widgets)
add_subdirectory(ui)
@ -29,5 +36,8 @@ target_link_libraries(squawk squawkUI)
target_link_libraries(squawk squawkCORE)
target_link_libraries(squawk uuid)
add_dependencies(${CMAKE_PROJECT_NAME} translations)
# Install the executable
install(TARGETS squawk DESTINATION bin)
install(FILES ${QM_FILES} DESTINATION share/l10n)

View File

@ -20,6 +20,7 @@
#define GLOBAL_H
#include <QString>
#include <QCoreApplication>
#include <deque>
#include <QDateTime>
#include <QDataStream>
@ -99,7 +100,6 @@ static const std::deque<QString> subscriptionStateNames = {"None", "From", "To",
static const std::deque<QString> affiliationNames = {"Unspecified", "Outcast", "Nobody", "Member", "Admin", "Owner"};
static const std::deque<QString> roleNames = {"Unspecified", "Nobody", "Visitor", "Participant", "Moderator"};
QString generateUUID();
class Message {

View File

@ -23,6 +23,8 @@
#include <QtCore/QThread>
#include <QtCore/QObject>
#include <QSettings>
#include <QTranslator>
#include <QLibraryInfo>
int main(int argc, char *argv[])
{
@ -36,7 +38,15 @@ int main(int argc, char *argv[])
QCoreApplication::setOrganizationName("Macaw");
QCoreApplication::setOrganizationDomain("macaw.me");
QCoreApplication::setApplicationName("Squawk");
QCoreApplication::setApplicationVersion("0.0.3");
QCoreApplication::setApplicationVersion("0.0.4");
QTranslator qtTranslator;
qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app.installTranslator(&qtTranslator);
QTranslator myappTranslator;
myappTranslator.load(QLocale(), QLatin1String("squawk"), ".");
app.installTranslator(&myappTranslator);
QIcon icon;
icon.addFile(":images/logo.svg", QSize(16, 16));

639
translations/squawk.ru.ts Normal file
View File

@ -0,0 +1,639 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru_RU">
<context>
<name>Account</name>
<message>
<location filename="../ui/widgets/account.ui" line="14"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_account.h" line="127"/>
<source>Account</source>
<translatorcomment>Заголовок окна</translatorcomment>
<translation>Учетная запись</translation>
</message>
<message>
<location filename="../ui/widgets/account.ui" line="40"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_account.h" line="129"/>
<source>Your account login</source>
<translation>Имя пользователя Вашей учетной записи</translation>
</message>
<message>
<location filename="../ui/widgets/account.ui" line="43"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_account.h" line="131"/>
<source>john_smith1987</source>
<translation>ivan_ivanov1987</translation>
</message>
<message>
<location filename="../ui/widgets/account.ui" line="50"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_account.h" line="132"/>
<source>Server</source>
<translation>Сервер</translation>
</message>
<message>
<location filename="../ui/widgets/account.ui" line="57"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_account.h" line="134"/>
<source>A server address of your account. Like 404.city or macaw.me</source>
<translation>Адресс сервера вашей учетной записи (выглядит как 404.city или macaw.me)</translation>
</message>
<message>
<location filename="../ui/widgets/account.ui" line="60"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_account.h" line="136"/>
<source>macaw.me</source>
<translation>macaw.me</translation>
</message>
<message>
<location filename="../ui/widgets/account.ui" line="67"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_account.h" line="137"/>
<source>Login</source>
<translation>Имя учетной записи</translation>
</message>
<message>
<location filename="../ui/widgets/account.ui" line="74"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_account.h" line="138"/>
<source>Password</source>
<translation>Пароль</translation>
</message>
<message>
<location filename="../ui/widgets/account.ui" line="81"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_account.h" line="140"/>
<source>Password of your account</source>
<translation>Пароль вашей учетной записи</translation>
</message>
<message>
<location filename="../ui/widgets/account.ui" line="103"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_account.h" line="145"/>
<source>Name</source>
<translation>Имя</translation>
</message>
<message>
<location filename="../ui/widgets/account.ui" line="110"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_account.h" line="147"/>
<source>Just a name how would you call this account, doesn&apos;t affect anything</source>
<translation>Просто имя, то как Вы называете свою учетную запись, может быть любым</translation>
</message>
<message>
<location filename="../ui/widgets/account.ui" line="113"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_account.h" line="149"/>
<source>John</source>
<translation>Иван</translation>
</message>
<message>
<location filename="../ui/widgets/account.ui" line="120"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_account.h" line="150"/>
<source>Resource</source>
<translation>Ресурс</translation>
</message>
<message>
<location filename="../ui/widgets/account.ui" line="127"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_account.h" line="152"/>
<source>A resource name like &quot;Home&quot; or &quot;Work&quot;</source>
<translation>Имя этой программы для ваших контактов, может быть &quot;Home&quot; или &quot;Phone&quot;</translation>
</message>
<message>
<location filename="../ui/widgets/account.ui" line="130"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_account.h" line="154"/>
<source>QXmpp</source>
<translatorcomment>Ресурс по умолчанию</translatorcomment>
<translation>QXmpp</translation>
</message>
</context>
<context>
<name>Accounts</name>
<message>
<location filename="../ui/widgets/accounts.ui" line="14"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_accounts.h" line="108"/>
<source>Accounts</source>
<translation>Учетные записи</translation>
</message>
<message>
<location filename="../ui/widgets/accounts.ui" line="45"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_accounts.h" line="109"/>
<source>Delete</source>
<translation>Удалить</translation>
</message>
<message>
<location filename="../ui/widgets/accounts.ui" line="86"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_accounts.h" line="110"/>
<source>Add</source>
<translation>Добавить</translation>
</message>
<message>
<location filename="../ui/widgets/accounts.ui" line="96"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_accounts.h" line="111"/>
<source>Edit</source>
<translation>Редактировать</translation>
</message>
<message>
<location filename="../ui/widgets/accounts.ui" line="106"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_accounts.h" line="112"/>
<source>Change password</source>
<translation>Изменить пароль</translation>
</message>
<message>
<location filename="../ui/widgets/accounts.ui" line="129"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_accounts.h" line="113"/>
<location filename="../ui/widgets/accounts.cpp" line="126"/>
<location filename="../ui/widgets/accounts.cpp" line="129"/>
<source>Connect</source>
<translation>Подключить</translation>
</message>
<message>
<location filename="../ui/widgets/accounts.cpp" line="123"/>
<source>Disconnect</source>
<translation>Отключить</translation>
</message>
</context>
<context>
<name>Conversation</name>
<message>
<location filename="../ui/widgets/conversation.ui" line="449"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_conversation.h" line="324"/>
<source>Type your message here...</source>
<translation>Введите сообщение...</translation>
</message>
</context>
<context>
<name>Global</name>
<message>
<source>Disconnected</source>
<translation>Отключен</translation>
</message>
<message>
<source>Connecting</source>
<translation>Подключается</translation>
</message>
<message>
<source>Connected</source>
<translation>Подключен</translation>
</message>
<message>
<source>Error</source>
<translation>Ошибка</translation>
</message>
<message>
<source>Online</source>
<translation>В сети</translation>
</message>
<message>
<source>Away</source>
<translation>Отошел</translation>
</message>
<message>
<source>Busy</source>
<translation>Занят</translation>
</message>
<message>
<source>Absent</source>
<translation>Недоступен</translation>
</message>
<message>
<source>Chatty</source>
<translation>Готов поболтать</translation>
</message>
<message>
<source>Invisible</source>
<translation>Невидимый</translation>
</message>
<message>
<source>Offline</source>
<translation>Отключен</translation>
</message>
<message>
<source>None</source>
<translation>Нет</translation>
</message>
<message>
<source>From</source>
<translation>Входящая</translation>
</message>
<message>
<source>To</source>
<translation>Исходящая</translation>
</message>
<message>
<source>Both</source>
<translation>Взаимная</translation>
</message>
<message>
<source>Unknown</source>
<translation>Неизвестно</translation>
</message>
<message>
<source>Unspecified</source>
<translation>Не назначено</translation>
</message>
<message>
<source>Outcast</source>
<translation>Изгой</translation>
</message>
<message>
<source>Nobody</source>
<translation>Никто</translation>
</message>
<message>
<source>Member</source>
<translation>Участник</translation>
</message>
<message>
<source>Admin</source>
<translation>Администратор</translation>
</message>
<message>
<source>Owner</source>
<translation>Владелец</translation>
</message>
<message>
<source>Visitor</source>
<translation>Гость</translation>
</message>
<message>
<source>Participant</source>
<translation>Участник</translation>
</message>
<message>
<source>Moderator</source>
<translation>Модератор</translation>
</message>
</context>
<context>
<name>JoinConference</name>
<message>
<location filename="../ui/widgets/joinconference.ui" line="14"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_joinconference.h" line="116"/>
<source>Join new conference</source>
<translatorcomment>Заголовок окна</translatorcomment>
<translation>Присоединиться к новой беседе</translation>
</message>
<message>
<location filename="../ui/widgets/joinconference.ui" line="22"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_joinconference.h" line="117"/>
<source>JID</source>
<translation>JID</translation>
</message>
<message>
<location filename="../ui/widgets/joinconference.ui" line="29"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_joinconference.h" line="119"/>
<source>Room JID</source>
<translation>Jabber-идентификатор беседы</translation>
</message>
<message>
<location filename="../ui/widgets/joinconference.ui" line="32"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_joinconference.h" line="121"/>
<source>identifier@conference.server.org</source>
<translation>identifier@conference.server.org</translation>
</message>
<message>
<location filename="../ui/widgets/joinconference.ui" line="39"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_joinconference.h" line="122"/>
<source>Account</source>
<translation>Учетная запись</translation>
</message>
<message>
<location filename="../ui/widgets/joinconference.ui" line="49"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_joinconference.h" line="123"/>
<source>Join on login</source>
<translation>Автовход</translation>
</message>
<message>
<location filename="../ui/widgets/joinconference.ui" line="56"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_joinconference.h" line="125"/>
<source>If checked Squawk will try to join this conference on login</source>
<translation>Если стоит галочка Squawk автоматически присоединится к этой беседе при подключении</translation>
</message>
<message>
<location filename="../ui/widgets/joinconference.ui" line="66"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_joinconference.h" line="128"/>
<source>Nick name</source>
<translation>Псевдоним</translation>
</message>
<message>
<location filename="../ui/widgets/joinconference.ui" line="73"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_joinconference.h" line="130"/>
<source>Your nick name for that conference. If you leave this field empty your account name will be used as a nick name</source>
<translation>Ваш псевдоним в этой беседе, если оставите это поле пустым - будет использовано имя Вашей учетной записи</translation>
</message>
<message>
<location filename="../ui/widgets/joinconference.ui" line="76"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_joinconference.h" line="132"/>
<source>John</source>
<translation>Ivan</translation>
</message>
</context>
<context>
<name>Message</name>
<message>
<location filename="../ui/utils/message.cpp" line="120"/>
<source>Download</source>
<translation>Скачать</translation>
</message>
<message>
<location filename="../ui/utils/message.cpp" line="124"/>
<source>Error downloading file: %1
You can try again</source>
<translation>Ошибка загрузки файла: %1
Вы можете попробовать снова</translation>
</message>
<message>
<location filename="../ui/utils/message.cpp" line="126"/>
<source>%1 is offering you to download a file</source>
<translation>%1 предлагает Вам скачать файл</translation>
</message>
<message>
<location filename="../ui/utils/message.cpp" line="191"/>
<source>Open</source>
<translation>Открыть</translation>
</message>
</context>
<context>
<name>Models::Accounts</name>
<message>
<source>Name</source>
<translation>Имя</translation>
</message>
<message>
<source>Server</source>
<translation>Сервер</translation>
</message>
<message>
<source>State</source>
<translation>Состояние</translation>
</message>
<message>
<source>Error</source>
<translation>Ошибка</translation>
</message>
</context>
<context>
<name>Models::Room</name>
<message>
<location filename="../ui/models/room.cpp" line="196"/>
<source>Subscribed</source>
<translation>Вы состоите в беседе</translation>
</message>
<message>
<location filename="../ui/models/room.cpp" line="198"/>
<source>Temporarily unsubscribed</source>
<translation>Вы временно не состоите в беседе</translation>
</message>
<message>
<location filename="../ui/models/room.cpp" line="202"/>
<source>Temporarily subscribed</source>
<translation>Вы временно состоите в беседе</translation>
</message>
<message>
<location filename="../ui/models/room.cpp" line="204"/>
<source>Unsubscribed</source>
<translation>Вы не состоите в беседе</translation>
</message>
</context>
<context>
<name>Models::Roster</name>
<message>
<location filename="../ui/models/roster.cpp" line="79"/>
<source>New messages</source>
<translation>Есть непрочитанные сообщения</translation>
</message>
<message>
<location filename="../ui/models/roster.cpp" line="152"/>
<location filename="../ui/models/roster.cpp" line="178"/>
<location filename="../ui/models/roster.cpp" line="215"/>
<location filename="../ui/models/roster.cpp" line="227"/>
<source>New messages: </source>
<translation>Новых сообщений: </translation>
</message>
<message>
<location filename="../ui/models/roster.cpp" line="154"/>
<source>Jabber ID: </source>
<translation>Идентификатор: </translation>
</message>
<message>
<location filename="../ui/models/roster.cpp" line="158"/>
<location filename="../ui/models/roster.cpp" line="181"/>
<location filename="../ui/models/roster.cpp" line="194"/>
<source>Availability: </source>
<translation>Доступность: </translation>
</message>
<message>
<location filename="../ui/models/roster.cpp" line="162"/>
<location filename="../ui/models/roster.cpp" line="184"/>
<location filename="../ui/models/roster.cpp" line="197"/>
<source>Status: </source>
<translation>Статус: </translation>
</message>
<message>
<location filename="../ui/models/roster.cpp" line="165"/>
<location filename="../ui/models/roster.cpp" line="167"/>
<location filename="../ui/models/roster.cpp" line="229"/>
<source>Subscription: </source>
<translation>Подписка: </translation>
</message>
<message>
<location filename="../ui/models/roster.cpp" line="200"/>
<source>Affiliation: </source>
<translatorcomment>Я правда не знаю, как это объяснить, не то что перевести</translatorcomment>
<translation>Причастность: </translation>
</message>
<message>
<location filename="../ui/models/roster.cpp" line="203"/>
<source>Role: </source>
<translation>Роль: </translation>
</message>
<message>
<location filename="../ui/models/roster.cpp" line="217"/>
<source>Online contacts: </source>
<translation>Контакстов в сети: </translation>
</message>
<message>
<location filename="../ui/models/roster.cpp" line="218"/>
<source>Total contacts: </source>
<translation>Всего контактов: </translation>
</message>
<message>
<location filename="../ui/models/roster.cpp" line="231"/>
<source>Members: </source>
<translation>Участников: </translation>
</message>
</context>
<context>
<name>NewContact</name>
<message>
<location filename="../ui/widgets/newcontact.ui" line="14"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_newcontact.h" line="103"/>
<source>Add new contact</source>
<translatorcomment>Заголовок окна</translatorcomment>
<translation>Добавление нового контакта</translation>
</message>
<message>
<location filename="../ui/widgets/newcontact.ui" line="22"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_newcontact.h" line="104"/>
<source>Account</source>
<translation>Учетная запись</translation>
</message>
<message>
<location filename="../ui/widgets/newcontact.ui" line="29"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_newcontact.h" line="106"/>
<source>An account that is going to have new contact</source>
<translation>Учетная запись для которой будет добавлен контакт</translation>
</message>
<message>
<location filename="../ui/widgets/newcontact.ui" line="36"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_newcontact.h" line="108"/>
<source>JID</source>
<translation>JID</translation>
</message>
<message>
<location filename="../ui/widgets/newcontact.ui" line="43"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_newcontact.h" line="110"/>
<source>Jabber id of your new contact</source>
<translation>Jabber-идентификатор нового контакта</translation>
</message>
<message>
<location filename="../ui/widgets/newcontact.ui" line="46"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_newcontact.h" line="112"/>
<source>name@server.dmn</source>
<translatorcomment>Placeholder поля ввода JID</translatorcomment>
<translation>name@server.dmn</translation>
</message>
<message>
<location filename="../ui/widgets/newcontact.ui" line="53"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_newcontact.h" line="113"/>
<source>Name</source>
<translation>Имя</translation>
</message>
<message>
<location filename="../ui/widgets/newcontact.ui" line="60"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_newcontact.h" line="115"/>
<source>The way this new contact will be labeled in your roster (optional)</source>
<translation>То, как будет подписан контакт в вашем списке контактов (не обязательно)</translation>
</message>
<message>
<location filename="../ui/widgets/newcontact.ui" line="63"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_newcontact.h" line="117"/>
<source>John Smith</source>
<translation>Иван Иванов</translation>
</message>
</context>
<context>
<name>Squawk</name>
<message>
<location filename="../ui/squawk.ui" line="14"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_squawk.h" line="130"/>
<source>squawk</source>
<translation>Squawk</translation>
</message>
<message>
<location filename="../ui/squawk.ui" line="75"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_squawk.h" line="136"/>
<source>Settings</source>
<translation>Настройки</translation>
</message>
<message>
<location filename="../ui/squawk.ui" line="81"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_squawk.h" line="137"/>
<source>Squawk</source>
<translation>Squawk</translation>
</message>
<message>
<location filename="../ui/squawk.ui" line="96"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_squawk.h" line="131"/>
<source>Accounts</source>
<translation>Учетные записи</translation>
</message>
<message>
<location filename="../ui/squawk.ui" line="105"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_squawk.h" line="132"/>
<source>Quit</source>
<translation>Выйти</translation>
</message>
<message>
<location filename="../ui/squawk.ui" line="117"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_squawk.h" line="133"/>
<source>Add contact</source>
<translation>Добавить контакт</translation>
</message>
<message>
<location filename="../ui/squawk.ui" line="128"/>
<location filename="../build/ui/squawkUI_autogen/include/ui_squawk.h" line="134"/>
<source>Add conference</source>
<translation>Присоединиться к беседе</translation>
</message>
<message>
<location filename="../ui/squawk.cpp" line="529"/>
<source>Disconnect</source>
<translation>Отключить</translation>
</message>
<message>
<location filename="../ui/squawk.cpp" line="535"/>
<source>Connect</source>
<translation>Подключить</translation>
</message>
<message>
<location filename="../ui/squawk.cpp" line="541"/>
<location filename="../ui/squawk.cpp" line="635"/>
<location filename="../ui/squawk.cpp" line="675"/>
<source>Remove</source>
<translation>Удалить</translation>
</message>
<message>
<location filename="../ui/squawk.cpp" line="553"/>
<source>Open dialog</source>
<translation>Открыть диалог</translation>
</message>
<message>
<location filename="../ui/squawk.cpp" line="563"/>
<location filename="../ui/squawk.cpp" line="656"/>
<source>Unsubscribe</source>
<translation>Отписаться</translation>
</message>
<message>
<location filename="../ui/squawk.cpp" line="573"/>
<location filename="../ui/squawk.cpp" line="665"/>
<source>Subscribe</source>
<translation>Подписаться</translation>
</message>
<message>
<location filename="../ui/squawk.cpp" line="584"/>
<source>Rename</source>
<translation>Переименовать</translation>
</message>
<message>
<location filename="../ui/squawk.cpp" line="597"/>
<source>Input new name for %1
or leave it empty for the contact
to be displayed as %1</source>
<translation>Введите имя для %1
или оставьте пустым,
тогда контакт будет отображаться как
%1</translation>
</message>
<message>
<location filename="../ui/squawk.cpp" line="598"/>
<source>Renaming %1</source>
<translation>Назначение имени контакту %1</translation>
</message>
<message>
<location filename="../ui/squawk.cpp" line="604"/>
<source>Groups</source>
<translation>Группы</translation>
</message>
<message>
<location filename="../ui/squawk.cpp" line="619"/>
<source>New group</source>
<translation>Создать новую группу</translation>
</message>
<message>
<location filename="../ui/squawk.cpp" line="629"/>
<source>New group name</source>
<translation>Имя группы</translation>
</message>
<message>
<location filename="../ui/squawk.cpp" line="630"/>
<source>Add %1 to a new group</source>
<translation>Добавление %1 в новую группу</translation>
</message>
<message>
<location filename="../ui/squawk.cpp" line="647"/>
<source>Open conversation</source>
<translation>Открыть окно беседы</translation>
</message>
</context>
</TS>

View File

@ -151,7 +151,7 @@ QVariant Models::Account::data(int column) const
case 1:
return server;
case 2:
return Shared::connectionStateNames[state];
return QCoreApplication::translate("Global", Shared::connectionStateNames[state].toLatin1());
case 3:
return error;
case 4:
@ -159,7 +159,7 @@ QVariant Models::Account::data(int column) const
case 5:
return password;
case 6:
return Shared::availabilityNames[availability];
return QCoreApplication::translate("Global", Shared::availabilityNames[availability].toLatin1());
case 7:
return resource;
default:

View File

@ -20,13 +20,9 @@
#include "../../global.h"
#include <QIcon>
#include <QDebug>
std::deque<QString> Models::Accounts::columns = {
"name",
"server",
"state",
"error"
};
std::deque<QString> Models::Accounts::columns = {"Name", "Server", "State", "Error"};
Models::Accounts::Accounts(QObject* parent):
QAbstractTableModel(parent),
@ -72,7 +68,7 @@ int Models::Accounts::rowCount ( const QModelIndex& parent ) const
QVariant Models::Accounts::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role == Qt::DisplayRole && orientation == Qt::Horizontal) {
return columns[section];
return tr(columns[section].toLatin1());
}
return QVariant();
}
@ -81,7 +77,18 @@ QVariant Models::Accounts::headerData(int section, Qt::Orientation orientation,
void Models::Accounts::addAccount(Account* account)
{
beginInsertRows(QModelIndex(), accs.size(), accs.size());
accs.push_back(account);
int index = 0;
std::deque<Account*>::const_iterator before = accs.begin();
while (before != accs.end()) {
Account* bfr = *before;
if (bfr->getDisplayedName() > account->getDisplayedName()) {
break;
}
index++;
before++;
}
accs.insert(before, account);
connect(account, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(onAccountChanged(Models::Item*, int, int)));
endInsertRows();
@ -96,8 +103,32 @@ void Models::Accounts::onAccountChanged(Item* item, int row, int col)
return; //it means the signal is emitted by one of accounts' children, not exactly him, this model has no interest in that
}
if (col == 0) {
int newRow = 0;
std::deque<Account*>::const_iterator before = accs.begin();
while (before != accs.end()) {
Item* bfr = *before;
if (bfr->getDisplayedName() > item->getDisplayedName()) {
break;
}
newRow++;
before++;
}
if (newRow != row || (before != accs.end() && *before != item)) {
emit beginMoveRows(createIndex(row, 0), row, row, createIndex(newRow, 0), newRow);
std::deque<Account*>::const_iterator old = accs.begin();
old += row;
accs.erase(old);
accs.insert(before, acc);
emit endMoveRows();
row = newRow;
}
}
if (col < columnCount(QModelIndex())) {
emit dataChanged(createIndex(row, col, this), createIndex(row, col, this));
emit dataChanged(createIndex(row, col), createIndex(row, col));
}
emit changed();
}

View File

@ -193,15 +193,15 @@ QString Models::Room::getStatusText() const
{
if (autoJoin) {
if (joined) {
return "Subscribed";
return tr("Subscribed");
} else {
return "Temporarily unsubscribed";
return tr("Temporarily unsubscribed");
}
} else {
if (joined) {
return "Temporarily subscribed";
return tr("Temporarily subscribed");
} else {
return "Unsubscribed";
return tr("Unsubscribed");
}
}
}

View File

@ -21,8 +21,6 @@
#include <QIcon>
#include <QFont>
using namespace Models;
Models::Roster::Roster(QObject* parent):
QAbstractItemModel(parent),
accountsModel(new Accounts()),
@ -78,7 +76,7 @@ QVariant Models::Roster::data (const QModelIndex& index, int role) const
str += gr->getName();
unsigned int amount = gr->getUnreadMessages();
if (amount > 0) {
str += QString(" (") + "New messages" + ")";
str += QString(" (") + tr("New messages") + ")";
}
result = str;
@ -143,7 +141,7 @@ QVariant Models::Roster::data (const QModelIndex& index, int role) const
switch (item->type) {
case Item::account: {
Account* acc = static_cast<Account*>(item);
result = QString(Shared::availabilityNames[acc->getAvailability()]);
result = QCoreApplication::translate("Global", Shared::availabilityNames[acc->getAvailability()].toLatin1());
}
break;
case Item::contact: {
@ -151,22 +149,22 @@ QVariant Models::Roster::data (const QModelIndex& index, int role) const
QString str("");
int mc = contact->getMessagesCount();
if (mc > 0) {
str += QString("New messages: ") + std::to_string(mc).c_str() + "\n";
str += QString(tr("New messages: ")) + std::to_string(mc).c_str() + "\n";
}
str += "Jabber ID: " + contact->getJid() + "\n";
str += tr("Jabber ID: ") + contact->getJid() + "\n";
Shared::SubscriptionState ss = contact->getState();
if (ss == Shared::both) {
Shared::Availability av = contact->getAvailability();
str += "Availability: " + Shared::availabilityNames[av];
str += tr("Availability: ") + QCoreApplication::translate("Global", Shared::availabilityNames[av].toLatin1());
if (av != Shared::offline) {
QString s = contact->getStatus();
if (s.size() > 0) {
str += "\nStatus: " + s;
str += "\n" + tr("Status: ") + s;
}
}
str += "\nSubscription: " + Shared::subscriptionStateNames[ss];
str += "\n" + tr("Subscription: ") + QCoreApplication::translate("Global", Shared::subscriptionStateNames[ss].toLatin1());
} else {
str += "Subscription: " + Shared::subscriptionStateNames[ss];
str += tr("Subscription: ") + QCoreApplication::translate("Global", Shared::subscriptionStateNames[ss].toLatin1());
}
result = str;
@ -177,13 +175,13 @@ QVariant Models::Roster::data (const QModelIndex& index, int role) const
QString str("");
int mc = contact->getMessagesCount();
if (mc > 0) {
str += QString("New messages: ") + std::to_string(mc).c_str() + "\n";
str += tr("New messages: ") + std::to_string(mc).c_str() + "\n";
}
Shared::Availability av = contact->getAvailability();
str += "Availability: " + Shared::availabilityNames[av];
str += tr("Availability: ") + QCoreApplication::translate("Global", Shared::availabilityNames[av].toLatin1());
QString s = contact->getStatus();
if (s.size() > 0) {
str += "\nStatus: " + s;
str += "\n" + tr("Status: ") + s;
}
result = str;
@ -193,14 +191,18 @@ QVariant Models::Roster::data (const QModelIndex& index, int role) const
Participant* p = static_cast<Participant*>(item);
QString str("");
Shared::Availability av = p->getAvailability();
str += "Availability: " + Shared::availabilityNames[av] + "\n";
str += tr("Availability: ") + QCoreApplication::translate("Global", Shared::availabilityNames[av].toLatin1()) + "\n";
QString s = p->getStatus();
if (s.size() > 0) {
str += "Status: " + s + "\n";
str += tr("Status: ") + s + "\n";
}
str += "Affiliation: " + Shared::affiliationNames[static_cast<unsigned int>(p->getAffiliation())] + "\n";
str += "Role: " + Shared::roleNames[static_cast<unsigned int>(p->getRole())];
str += tr("Affiliation: ") +
QCoreApplication::translate("Global",
Shared::affiliationNames[static_cast<unsigned int>(p->getAffiliation())].toLatin1()) + "\n";
str += tr("Role: ") +
QCoreApplication::translate("Global",
Shared::roleNames[static_cast<unsigned int>(p->getRole())].toLatin1());
result = str;
}
@ -210,10 +212,10 @@ QVariant Models::Roster::data (const QModelIndex& index, int role) const
unsigned int count = gr->getUnreadMessages();
QString str("");
if (count > 0) {
str += QString("New messages: ") + std::to_string(count).c_str() + "\n";
str += tr("New messages: ") + std::to_string(count).c_str() + "\n";
}
str += QString("Online contacts: ") + std::to_string(gr->getOnlineContacts()).c_str() + "\n";
str += QString("Total contacts: ") + std::to_string(gr->childCount()).c_str();
str += tr("Online contacts: ") + std::to_string(gr->getOnlineContacts()).c_str() + "\n";
str += tr("Total contacts: ") + std::to_string(gr->childCount()).c_str();
result = str;
}
break;
@ -222,11 +224,11 @@ QVariant Models::Roster::data (const QModelIndex& index, int role) const
unsigned int count = rm->getUnreadMessagesCount();
QString str("");
if (count > 0) {
str += QString("New messages: ") + std::to_string(count).c_str() + "\n";
str += tr("New messages: ") + std::to_string(count).c_str() + "\n";
}
str += QString("Subscription: ") + rm->getStatusText();
str += tr("Subscription: ") + rm->getStatusText();
if (rm->getJoined()) {
str += QString("\nMembers: ") + std::to_string(rm->childCount()).c_str();
str += QString("\n") + tr("Members: ") + std::to_string(rm->childCount()).c_str();
}
result = str;
}

View File

@ -37,7 +37,7 @@ Squawk::Squawk(QWidget *parent) :
for (unsigned int i = Shared::availabilityLowest; i < Shared::availabilityHighest + 1; ++i) {
Shared::Availability av = static_cast<Shared::Availability>(i);
m_ui->comboBox->addItem(Shared::availabilityIcon(av), Shared::availabilityNames[av]);
m_ui->comboBox->addItem(Shared::availabilityIcon(av), QCoreApplication::translate("Global", Shared::availabilityNames[av].toLatin1()));
}
m_ui->comboBox->setCurrentIndex(Shared::offline);
@ -526,20 +526,19 @@ void Squawk::onRosterContextMenu(const QPoint& point)
QString name = acc->getName();
if (acc->getState() != Shared::disconnected) {
QAction* con = contextMenu->addAction(Shared::icon("network-disconnect"), "Disconnect");
QAction* con = contextMenu->addAction(Shared::icon("network-disconnect"), tr("Disconnect"));
con->setEnabled(active);
connect(con, &QAction::triggered, [this, name]() {
emit disconnectAccount(name);
});
} else {
QAction* con = contextMenu->addAction(Shared::icon("network-connect"), "Connect");
con->setEnabled(active);
QAction* con = contextMenu->addAction(Shared::icon("network-connect"), tr("Connect"));
connect(con, &QAction::triggered, [this, name]() {
emit connectAccount(name);
});
}
QAction* remove = contextMenu->addAction(Shared::icon("edit-delete"), "Remove");
QAction* remove = contextMenu->addAction(Shared::icon("edit-delete"), tr("Remove"));
remove->setEnabled(active);
connect(remove, &QAction::triggered, [this, name]() {
emit removeAccount(name);
@ -551,7 +550,7 @@ void Squawk::onRosterContextMenu(const QPoint& point)
Models::Contact* cnt = static_cast<Models::Contact*>(item);
hasMenu = true;
QAction* dialog = contextMenu->addAction(Shared::icon("mail-message"), "Open dialog");
QAction* dialog = contextMenu->addAction(Shared::icon("mail-message"), tr("Open dialog"));
dialog->setEnabled(active);
connect(dialog, &QAction::triggered, [this, index]() {
onRosterItemDoubleClicked(index);
@ -561,7 +560,7 @@ void Squawk::onRosterContextMenu(const QPoint& point)
switch (state) {
case Shared::both:
case Shared::to: {
QAction* unsub = contextMenu->addAction(Shared::icon("news-unsubscribe"), "Unsubscribe");
QAction* unsub = contextMenu->addAction(Shared::icon("news-unsubscribe"), tr("Unsubscribe"));
unsub->setEnabled(active);
connect(unsub, &QAction::triggered, [this, cnt]() {
emit unsubscribeContact(cnt->getAccountName(), cnt->getJid(), "");
@ -571,7 +570,7 @@ void Squawk::onRosterContextMenu(const QPoint& point)
case Shared::from:
case Shared::unknown:
case Shared::none: {
QAction* sub = contextMenu->addAction(Shared::icon("news-subscribe"), "Subscribe");
QAction* sub = contextMenu->addAction(Shared::icon("news-subscribe"), tr("Subscribe"));
sub->setEnabled(active);
connect(sub, &QAction::triggered, [this, cnt]() {
emit subscribeContact(cnt->getAccountName(), cnt->getJid(), "");
@ -582,7 +581,7 @@ void Squawk::onRosterContextMenu(const QPoint& point)
QString cntJID = cnt->getJid();
QString cntName = cnt->getName();
QAction* rename = contextMenu->addAction(Shared::icon("edit-rename"), "Rename");
QAction* rename = contextMenu->addAction(Shared::icon("edit-rename"), tr("Rename"));
rename->setEnabled(active);
connect(rename, &QAction::triggered, [this, cntName, accName, cntJID]() {
QInputDialog* dialog = new QInputDialog(this);
@ -595,14 +594,14 @@ void Squawk::onRosterContextMenu(const QPoint& point)
});
connect(dialog, &QDialog::rejected, dialog, &QObject::deleteLater);
dialog->setInputMode(QInputDialog::TextInput);
dialog->setLabelText("Input new name for " + cntJID + " \nor leave it empty for the contact \nto be displayed as " + cntJID);
dialog->setWindowTitle("Renaming " + cntJID);
dialog->setLabelText(tr("Input new name for %1\nor leave it empty for the contact \nto be displayed as %1").arg(cntJID));
dialog->setWindowTitle(tr("Renaming %1").arg(cntJID));
dialog->setTextValue(cntName);
dialog->exec();
});
QMenu* groupsMenu = contextMenu->addMenu(Shared::icon("group"), "Groups");
QMenu* groupsMenu = contextMenu->addMenu(Shared::icon("group"), tr("Groups"));
std::deque<QString> groupList = rosterModel.groupList(accName);
for (QString groupName : groupList) {
QAction* gr = groupsMenu->addAction(groupName);
@ -617,7 +616,7 @@ void Squawk::onRosterContextMenu(const QPoint& point)
}
});
}
QAction* newGroup = groupsMenu->addAction(Shared::icon("resource-group-new"), "New group");
QAction* newGroup = groupsMenu->addAction(Shared::icon("resource-group-new"), tr("New group"));
newGroup->setEnabled(active);
connect(newGroup, &QAction::triggered, [this, accName, cntJID]() {
QInputDialog* dialog = new QInputDialog(this);
@ -627,13 +626,13 @@ void Squawk::onRosterContextMenu(const QPoint& point)
});
connect(dialog, &QDialog::rejected, dialog, &QObject::deleteLater);
dialog->setInputMode(QInputDialog::TextInput);
dialog->setLabelText("New group name");
dialog->setWindowTitle("Add " + cntJID + " to a new group");
dialog->setLabelText(tr("New group name"));
dialog->setWindowTitle(tr("Add %1 to a new group").arg(cntJID));
dialog->exec();
});
QAction* remove = contextMenu->addAction(Shared::icon("edit-delete"), "Remove");
QAction* remove = contextMenu->addAction(Shared::icon("edit-delete"), tr("Remove"));
remove->setEnabled(active);
connect(remove, &QAction::triggered, [this, cnt]() {
emit removeContactRequest(cnt->getAccountName(), cnt->getJid());
@ -645,7 +644,7 @@ void Squawk::onRosterContextMenu(const QPoint& point)
Models::Room* room = static_cast<Models::Room*>(item);
hasMenu = true;
QAction* dialog = contextMenu->addAction(Shared::icon("mail-message"), "Open conversation");
QAction* dialog = contextMenu->addAction(Shared::icon("mail-message"), tr("Open conversation"));
dialog->setEnabled(active);
connect(dialog, &QAction::triggered, [this, index]() {
onRosterItemDoubleClicked(index);
@ -654,7 +653,7 @@ void Squawk::onRosterContextMenu(const QPoint& point)
Models::Roster::ElId id(room->getAccountName(), room->getJid());
if (room->getAutoJoin()) {
QAction* unsub = contextMenu->addAction(Shared::icon("news-unsubscribe"), "Unsubscribe");
QAction* unsub = contextMenu->addAction(Shared::icon("news-unsubscribe"), tr("Unsubscribe"));
unsub->setEnabled(active);
connect(unsub, &QAction::triggered, [this, id]() {
emit setRoomAutoJoin(id.account, id.name, false);
@ -663,7 +662,7 @@ void Squawk::onRosterContextMenu(const QPoint& point)
}
});
} else {
QAction* unsub = contextMenu->addAction(Shared::icon("news-subscribe"), "Subscribe");
QAction* unsub = contextMenu->addAction(Shared::icon("news-subscribe"), tr("Subscribe"));
unsub->setEnabled(active);
connect(unsub, &QAction::triggered, [this, id]() {
emit setRoomAutoJoin(id.account, id.name, true);
@ -673,7 +672,7 @@ void Squawk::onRosterContextMenu(const QPoint& point)
});
}
QAction* remove = contextMenu->addAction(Shared::icon("edit-delete"), "Remove");
QAction* remove = contextMenu->addAction(Shared::icon("edit-delete"), tr("Remove"));
remove->setEnabled(active);
connect(remove, &QAction::triggered, [this, id]() {
emit removeRoomRequest(id.account, id.name);

View File

@ -22,7 +22,7 @@
#include <QFileInfo>
#include "message.h"
const QRegExp urlReg("^(?!<img\\ssrc=\")((?:https?|ftp)://\\S+)");
const QRegExp urlReg("(?!<img\\ssrc=\")((?:https?|ftp)://\\S+)");
const QRegExp imgReg("((?:https?|ftp)://\\S+\\.(?:jpg|jpeg|png|svg|gif))");
Message::Message(const Shared::Message& source, bool outgoing, const QString& p_sender, QWidget* parent):
@ -117,13 +117,13 @@ void Message::addDownloadDialog()
text->setText("");
text->hide();
}
downloadButton = new QPushButton(QIcon::fromTheme("download"), "Download");
downloadButton = new QPushButton(QIcon::fromTheme("download"), tr("Download"));
downloadButton->setToolTip("<a href=\"" + msg.getOutOfBandUrl() + "\">" + msg.getOutOfBandUrl() + "</a>");
if (errorDownloadingFile) {
fileComment->setWordWrap(true);
fileComment->setText("Error downloading file: " + errorText + "\nYou can try again");
fileComment->setText(tr("Error downloading file: %1\nYou can try again").arg(QCoreApplication::translate("NetworkErrors", errorText.toLatin1())));
} else {
fileComment->setText(sender->text() + " is offering you to download a file");
fileComment->setText(tr("%1 is offering you to download a file").arg(sender->text()));
}
fileComment->show();
connect(downloadButton, SIGNAL(clicked()), this, SLOT(onDownload()));
@ -188,7 +188,7 @@ void Message::showFile(const QString& path)
fileComment->show();
}
file->setContextMenuPolicy(Qt::ActionsContextMenu);
QAction* openAction = new QAction(QIcon::fromTheme("document-new-from-template"), "Open", file);
QAction* openAction = new QAction(QIcon::fromTheme("document-new-from-template"), tr("Open"), file);
connect(openAction, &QAction::triggered, [path]() { //TODO need to get rid of this shame
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
});

View File

@ -39,6 +39,9 @@
<property name="toolTip">
<string>Your account login</string>
</property>
<property name="placeholderText">
<string>john_smith1987</string>
</property>
</widget>
</item>
<item row="2" column="0">
@ -53,6 +56,9 @@
<property name="toolTip">
<string>A server address of your account. Like 404.city or macaw.me</string>
</property>
<property name="placeholderText">
<string>macaw.me</string>
</property>
</widget>
</item>
<item row="1" column="0">
@ -83,6 +89,9 @@
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
<property name="placeholderText">
<string/>
</property>
<property name="clearButtonEnabled">
<bool>false</bool>
</property>
@ -100,6 +109,9 @@
<property name="toolTip">
<string>Just a name how would you call this account, doesn't affect anything</string>
</property>
<property name="placeholderText">
<string>John</string>
</property>
</widget>
</item>
<item row="4" column="0">

View File

@ -120,13 +120,13 @@ void Accounts::updateConnectButton()
}
if (allConnected) {
toDisconnect = true;
m_ui->connectButton->setText("Disconnect");
m_ui->connectButton->setText(tr("Disconnect"));
} else {
toDisconnect = false;
m_ui->connectButton->setText("Connect");
m_ui->connectButton->setText(tr("Connect"));
}
} else {
m_ui->connectButton->setText("Connect");
m_ui->connectButton->setText(tr("Connect"));
toDisconnect = false;
m_ui->connectButton->setEnabled(false);
}

View File

@ -56,7 +56,7 @@ void Chat::updateState()
{
Shared::Availability av = contact->getAvailability();
statusIcon->setPixmap(Shared::availabilityIcon(av, true).pixmap(40));
statusIcon->setToolTip(Shared::availabilityNames[av]);
statusIcon->setToolTip(QCoreApplication::translate("Global", Shared::availabilityNames[av].toLatin1()));
}
void Chat::handleSendMessage(const QString& text)

View File

@ -445,6 +445,9 @@
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="placeholderText">
<string>Type your message here...</string>
</property>
</widget>
</item>
</layout>