Add English and Russian ChatGUI interface translations
This commit is contained in:
1 parent
972c6b7f0a
commit
27d93ecaf9
50 files changed
+4978
-491
No files matched your search
@@ -1,3 +1,4 @@
|
||||
#include <QCoreApplication>
|
||||
#include "dminvitedialog.h"
|
||||
#include "debug_ui.h"
|
||||
#include "../db/db_manager.h"
|
||||
@@ -18,28 +19,29 @@ extern "C" {
|
||||
|
||||
DmInviteDialog::DmInviteDialog(DbManager* db, quint64 peer, const QString& name, const QString& source, QWidget* parent)
|
||||
: QDialog(parent), m_peer(peer), m_name(name), m_source(source) {
|
||||
setWindowTitle(QStringLiteral("Пригласить в группу"));
|
||||
setWindowTitle(QCoreApplication::translate("ChatGui", "Invite to group"));
|
||||
setMinimumWidth(400);
|
||||
auto* layout = new QVBoxLayout(this);
|
||||
layout->addWidget(new QLabel(QStringLiteral("Получатель: %1").arg(name), this));
|
||||
layout->addWidget(new QLabel(QCoreApplication::translate("ChatGui", "Recipient: %1").arg(name), this));
|
||||
m_groups = new QComboBox(this);
|
||||
for (const auto& group : db->getChannels()) {
|
||||
if (db->isChannelMember(group.channelId, db->myNodeId())) m_groups->addItem(group.name, group.channelId);
|
||||
}
|
||||
m_groups->setCurrentIndex(-1);
|
||||
m_groups->setPlaceholderText(QStringLiteral("Выберите группу"));
|
||||
m_groups->setPlaceholderText(QCoreApplication::translate("ChatGui", "Select a group"));
|
||||
layout->addWidget(m_groups);
|
||||
auto* expiry = new QLabel(QStringLiteral("Ссылка действует %1 минут с момента создания.\n"
|
||||
"При поздней доставке PM потребуется новое приглашение.").arg(JOIN_KEY_TTL_SECONDS / 60), this);
|
||||
auto* expiry = new QLabel(QCoreApplication::translate("ChatGui",
|
||||
"The link expires %1 minutes after creation.\nIf the direct message arrives late, a new "
|
||||
"invitation will be needed.").arg(JOIN_KEY_TTL_SECONDS / 60), this);
|
||||
expiry->setWordWrap(true);
|
||||
layout->addWidget(expiry);
|
||||
m_status = new QLabel(this);
|
||||
m_status->setWordWrap(true);
|
||||
if (m_groups->count() == 0) m_status->setText(QStringLiteral("Нет групп для приглашения."));
|
||||
if (m_groups->count() == 0) m_status->setText(QCoreApplication::translate("ChatGui", "No groups available to invite to."));
|
||||
layout->addWidget(m_status);
|
||||
auto* buttons = new QDialogButtonBox(QDialogButtonBox::Cancel, this);
|
||||
buttons->button(QDialogButtonBox::Cancel)->setText(QStringLiteral("Отмена"));
|
||||
m_send = buttons->addButton(QStringLiteral("Пригласить"), QDialogButtonBox::AcceptRole);
|
||||
buttons->button(QDialogButtonBox::Cancel)->setText(QCoreApplication::translate("ChatGui", "Cancel"));
|
||||
m_send = buttons->addButton(QCoreApplication::translate("ChatGui", "Invite"), QDialogButtonBox::AcceptRole);
|
||||
m_send->setEnabled(false);
|
||||
layout->addWidget(buttons);
|
||||
connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
@@ -70,10 +72,11 @@ void DmInviteDialog::sendInvite() {
|
||||
if (m_pending || m_groups->currentIndex() < 0) return;
|
||||
if (!gui_bridge_is_uasync_ready() || !gui_bridge_get_inst()) {
|
||||
GUI_ERROR("invite PM: core unavailable");
|
||||
m_status->setText(QStringLiteral("Ядро не запущено.")); return;
|
||||
m_status->setText(QCoreApplication::translate("ChatGui", "The core is not running.")); return;
|
||||
}
|
||||
auto* req = (struct dm_invite_req*)u_calloc(1, sizeof(struct dm_invite_req));
|
||||
if (!req) { GUI_ERROR("invite PM: request allocation failed"); m_status->setText(QStringLiteral("Недостаточно памяти.")); return; }
|
||||
if (!req) { GUI_ERROR("invite PM: request allocation failed"); m_status->setText(QCoreApplication::translate("ChatGui",
|
||||
"Not enough memory.")); return; }
|
||||
static uint64_t nextRequestId = 0;
|
||||
req->inst = gui_bridge_get_inst(); req->request_id = m_requestId = ++nextRequestId; req->peer_node_id = m_peer;
|
||||
req->channel_id = m_groups->currentData().toString().toULongLong();
|
||||
@@ -81,7 +84,7 @@ void DmInviteDialog::sendInvite() {
|
||||
snprintf(req->peer_name, sizeof(req->peer_name), "%s", m_name.toUtf8().constData());
|
||||
m_pending = true;
|
||||
m_groups->setEnabled(false); m_send->setEnabled(false);
|
||||
m_status->setText(QStringLiteral("Создание и отправка приглашения…"));
|
||||
m_status->setText(QCoreApplication::translate("ChatGui", "Creating and sending invitation…"));
|
||||
gui_bridge_post_uasync_fn(dm_invite_trampoline, req);
|
||||
}
|
||||
|
||||
@@ -93,11 +96,11 @@ void DmInviteDialog::onResult(const uint8_t* data, int len) {
|
||||
if (!m_pending || request != m_requestId || peer != m_peer) return;
|
||||
m_pending = false;
|
||||
if (result == DM_INVITE_OK) { m_convId = QString::number(conv); accept(); return; }
|
||||
const QString error = result == DM_INVITE_START_ERROR ? QStringLiteral("Не удалось создать личную беседу.")
|
||||
: result == DM_INVITE_SEND_ERROR ? QStringLiteral("Не удалось отправить приглашение.")
|
||||
: result == DM_INVITE_BUSY ? QStringLiteral("Другое приглашение ещё создаётся. Повторите попытку.")
|
||||
: result == DM_INVITE_CANCELLED ? QStringLiteral("Создание приглашения отменено.")
|
||||
: QStringLiteral("Не удалось создать приглашение. Проверьте подключение и повторите попытку.");
|
||||
const QString error = result == DM_INVITE_START_ERROR ? QCoreApplication::translate("ChatGui", "Failed to create a direct conversation.")
|
||||
: result == DM_INVITE_SEND_ERROR ? QCoreApplication::translate("ChatGui", "Failed to send the invitation.")
|
||||
: result == DM_INVITE_BUSY ? QCoreApplication::translate("ChatGui", "Another invitation is still being created. Try again.")
|
||||
: result == DM_INVITE_CANCELLED ? QCoreApplication::translate("ChatGui", "Invitation creation cancelled.")
|
||||
: QCoreApplication::translate("ChatGui", "Failed to create an invitation. Check the connection and try again.");
|
||||
GUI_ERROR("invite PM dialog: failed request=%llu result=%d", (unsigned long long)request, result);
|
||||
m_status->setText(error); m_groups->setEnabled(true); m_send->setEnabled(m_groups->currentIndex() >= 0);
|
||||
}
|
||||
Reference in new issue
Block a user