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 "inviteby.h"
|
||||
#include "invite_link.h"
|
||||
#include "debug_ui.h"
|
||||
@@ -21,14 +22,14 @@ extern "C" {
|
||||
InviteByLinkDialog::InviteByLinkDialog(const QString& channelId, UtunNode* node, QWidget* parent)
|
||||
: QDialog(parent), m_channelId(channelId), m_node(node)
|
||||
{
|
||||
setWindowTitle(QString::fromUtf8("Пригласить в канал %1").arg(channelId));
|
||||
setWindowTitle(QCoreApplication::translate("ChatGui", "Invite to channel %1").arg(channelId));
|
||||
setMinimumWidth(420);
|
||||
setModal(true);
|
||||
|
||||
auto *layout = new QVBoxLayout(this);
|
||||
layout->setSpacing(12);
|
||||
|
||||
auto *title = new QLabel(QString::fromUtf8("Вставьте utun:// ссылку приглашаемого узла:"), this);
|
||||
auto *title = new QLabel(QCoreApplication::translate("ChatGui", "Paste the invited node's utun:// link:"), this);
|
||||
title->setStyleSheet("font-weight: bold; font-size: 12px;");
|
||||
layout->addWidget(title);
|
||||
|
||||
@@ -46,7 +47,7 @@ InviteByLinkDialog::InviteByLinkDialog(const QString& channelId, UtunNode* node,
|
||||
|
||||
auto *btnLayout = new QHBoxLayout();
|
||||
btnLayout->addStretch();
|
||||
m_inviteSendBtn = new QPushButton(QString::fromUtf8("Пригласить"), this);
|
||||
m_inviteSendBtn = new QPushButton(QCoreApplication::translate("ChatGui", "Invite"), this);
|
||||
m_inviteSendBtn->setStyleSheet(
|
||||
"QPushButton { border: none; border-radius: 4px;"
|
||||
" padding: 5px 14px; font-size: 12px; font-weight: bold;"
|
||||
@@ -83,14 +84,14 @@ void InviteByLinkDialog::onInviteLinkTextChanged() {
|
||||
}
|
||||
if (!link.startsWith(QLatin1String("utun://"))) {
|
||||
m_inviteStatusLabel->setStyleSheet("color: gray; font-size: 11px; padding: 2px 0;");
|
||||
m_inviteStatusLabel->setText(QString::fromUtf8("Ожидается utun:// ссылка..."));
|
||||
m_inviteStatusLabel->setText(QCoreApplication::translate("ChatGui", "Expected a utun:// link..."));
|
||||
return;
|
||||
}
|
||||
|
||||
InviteData d = decodeInviteLink(link);
|
||||
if (!d.error.isEmpty()) {
|
||||
m_inviteStatusLabel->setStyleSheet("color: gray; font-size: 11px; padding: 2px 0;");
|
||||
m_inviteStatusLabel->setText(QString::fromUtf8("Неверная ссылка: ") + d.error);
|
||||
m_inviteStatusLabel->setText(QCoreApplication::translate("ChatGui", "Invalid link: ") + d.error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -112,9 +113,9 @@ void InviteByLinkDialog::onInviteLinkTextChanged() {
|
||||
QString::fromLatin1(d.addrs[i].address.left(4).toHex())).arg(d.addrs[i].port);
|
||||
}
|
||||
}
|
||||
if (d.addrs.size() > 3) addrInfo += QString(" +%1 more").arg(d.addrs.size() - 3);
|
||||
if (d.addrs.size() > 3) addrInfo += QCoreApplication::translate("ChatGui", " +%1 more").arg(d.addrs.size() - 3);
|
||||
|
||||
QString diag = QString::fromUtf8("Ссылка: узел 0x%1 ключ %2, %3 адр. (%4)\nПриглашение в канал: %5")
|
||||
QString diag = QCoreApplication::translate("ChatGui", "Link: node 0x%1 key %2, %3 addresses (%4)\nInvitation to channel: %5")
|
||||
.arg(targetNodeId, 16, 16, QChar('0'))
|
||||
.arg(pkShort)
|
||||
.arg(d.addrs.size())
|
||||
@@ -123,7 +124,7 @@ void InviteByLinkDialog::onInviteLinkTextChanged() {
|
||||
|
||||
if (myNodeId != 0 && myNodeId == targetNodeId) {
|
||||
m_inviteStatusLabel->setStyleSheet("color: #E67E22; font-size: 11px; padding: 2px 0;");
|
||||
m_inviteStatusLabel->setText(diag + QString::fromUtf8(" ⚠ Это ваша собственная ссылка"));
|
||||
m_inviteStatusLabel->setText(diag + QCoreApplication::translate("ChatGui", " ⚠ This is your own link"));
|
||||
} else {
|
||||
m_inviteStatusLabel->setStyleSheet("color: gray; font-size: 11px; padding: 2px 0;");
|
||||
m_inviteStatusLabel->setText(diag);
|
||||
@@ -142,21 +143,21 @@ void InviteByLinkDialog::onSendInvite() {
|
||||
if (m_inviteSending) return;
|
||||
QString link = m_inviteLinkEdit->text().trimmed();
|
||||
if (link.isEmpty()) {
|
||||
setInviteStatus(QString::fromUtf8("Вставьте utun:// ссылку узла."), true);
|
||||
setInviteStatus(QCoreApplication::translate("ChatGui", "Paste the node's utun:// link."), true);
|
||||
return;
|
||||
}
|
||||
|
||||
InviteData d = decodeInviteLink(link);
|
||||
if (!d.error.isEmpty()) {
|
||||
setInviteStatus(QString::fromUtf8("Неверная ссылка: ") + d.error, true);
|
||||
setInviteStatus(QCoreApplication::translate("ChatGui", "Invalid link: ") + d.error, true);
|
||||
return;
|
||||
}
|
||||
if (d.pubkey.size() != 32) {
|
||||
setInviteStatus(QString::fromUtf8("Pubkey не 32 байта."), true);
|
||||
setInviteStatus(QCoreApplication::translate("ChatGui", "The public key must be 32 bytes."), true);
|
||||
return;
|
||||
}
|
||||
if (d.addrs.isEmpty()) {
|
||||
setInviteStatus(QString::fromUtf8("Нет адресов."), true);
|
||||
setInviteStatus(QCoreApplication::translate("ChatGui", "No addresses."), true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -166,7 +167,7 @@ void InviteByLinkDialog::onSendInvite() {
|
||||
uint64_t myNodeId = m_node ? m_node->nodeIdHex().toULongLong(nullptr, 16) : 0;
|
||||
if (myNodeId != 0 && myNodeId == targetNodeId) {
|
||||
GUI_WARN("invite_by_link: self-invite rejected — link contains own pubkey, node=0x%016llx", (unsigned long long)myNodeId);
|
||||
setInviteStatus(QString::fromUtf8("Ошибка: это ваша собственная ссылка (нельзя пригласить себя)"), true);
|
||||
setInviteStatus(QCoreApplication::translate("ChatGui", "Error: this is your own link (you cannot invite yourself)"), true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -186,27 +187,27 @@ void InviteByLinkDialog::onSendInvite() {
|
||||
(const uint8_t*)d.pubkey.constData(),
|
||||
(const uint8_t*)addrsBuf.constData(), d.addrs.size(), addrsBuf.size());
|
||||
|
||||
setInviteStatus(QString::fromUtf8("Приглашение отправлено, ожидание ответа..."));
|
||||
setInviteStatus(QCoreApplication::translate("ChatGui", "Invitation sent, waiting for a response..."));
|
||||
}
|
||||
|
||||
void InviteByLinkDialog::onConnectResult(uint64_t nodeId, uint64_t channelId, int result) {
|
||||
if (!m_inviteSending || nodeId != m_inviteTargetNodeId) return;
|
||||
|
||||
if (result == 0) {
|
||||
setInviteStatus(QString::fromUtf8("Узел присоединился к каналу."), false);
|
||||
setInviteStatus(QCoreApplication::translate("ChatGui", "The node has joined the channel."), false);
|
||||
QTimer::singleShot(400, this, &QDialog::accept);
|
||||
} else {
|
||||
m_inviteSending = false;
|
||||
m_inviteSendBtn->setEnabled(true);
|
||||
m_inviteSendBtn->setFocus();
|
||||
|
||||
const char* errMsg = "Неизвестная ошибка.";
|
||||
QString errMsg = QCoreApplication::translate("ChatGui", "Unknown error.");
|
||||
switch (result) {
|
||||
case -1: errMsg = "Канал не найден."; break;
|
||||
case 2: errMsg = "Таймаут — узел не ответил."; break;
|
||||
case -7: errMsg = "Узел не инициализирован."; break;
|
||||
case -1: errMsg = QCoreApplication::translate("ChatGui", "Channel not found."); break;
|
||||
case 2: errMsg = QCoreApplication::translate("ChatGui", "Timed out — the node did not respond."); break;
|
||||
case -7: errMsg = QCoreApplication::translate("ChatGui", "Node not initialized."); break;
|
||||
default: break;
|
||||
}
|
||||
setInviteStatus(QString::fromUtf8("Ошибка: %1").arg(QString::fromUtf8(errMsg)), true);
|
||||
setInviteStatus(QCoreApplication::translate("ChatGui", "Error: %1").arg(errMsg), true);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user