Add English and Russian ChatGUI interface translations

This commit is contained in:
evgeny committed 2026-10-05 16:55:43 +02:00
1 parent 972c6b7f0a
commit 27d93ecaf9
50 files changed
+4978 -491

No files matched your search

+24 -21
View File
@@ -1,3 +1,4 @@
#include <QCoreApplication>
#include "messagelist.h"
#include "debug_ui.h"
#include "chatview.h"
@@ -353,7 +354,7 @@ MessageList::MessageList(DbManager* db, AudioRecorder* recorder, QWidget *parent
hl->addWidget(m_peerStatus);
m_channelTitle = new QLabel(header);
m_channelTitle->setStyleSheet("font-weight: bold; font-size: 14px;");
m_channelTitle->setText(QStringLiteral("Канал"));
m_channelTitle->setText(QCoreApplication::translate("ChatGui", "Channel"));
hl->addWidget(m_channelTitle, 1);
m_talkingLabel = new QLabel(header);
@@ -362,8 +363,8 @@ MessageList::MessageList(DbManager* db, AudioRecorder* recorder, QWidget *parent
hl->addWidget(m_talkingLabel);
m_inviteBtn = new QPushButton(QStringLiteral("+"), header);
m_inviteBtn->setAccessibleName(QStringLiteral("Пригласить в группу"));
m_inviteBtn->setToolTip(QStringLiteral("Пригласить в группу"));
m_inviteBtn->setAccessibleName(QCoreApplication::translate("ChatGui", "Invite to group"));
m_inviteBtn->setToolTip(QCoreApplication::translate("ChatGui", "Invite to group"));
m_inviteBtn->setFixedSize(34, 30);
m_inviteBtn->setCursor(Qt::PointingHandCursor);
m_inviteBtn->hide();
@@ -380,7 +381,7 @@ MessageList::MessageList(DbManager* db, AudioRecorder* recorder, QWidget *parent
});
m_callBtn = new QPushButton(QStringLiteral("☎"), header);
m_callBtn->setAccessibleName(QStringLiteral("Позвонить"));
m_callBtn->setAccessibleName(QCoreApplication::translate("ChatGui", "Call peer"));
m_callBtn->setFixedSize(34, 30);
m_callBtn->setCursor(Qt::PointingHandCursor);
m_callBtn->hide();
@@ -394,11 +395,11 @@ MessageList::MessageList(DbManager* db, AudioRecorder* recorder, QWidget *parent
m_radioBtn = new QPushButton(header);
m_radioBtn->setIcon(makeRadioIcon(header->palette().color(QPalette::ButtonText)));
m_radioBtn->setIconSize(QSize(24, 24));
m_radioBtn->setAccessibleName(QStringLiteral("Рация"));
m_radioBtn->setAccessibleName(QCoreApplication::translate("ChatGui", "Radio"));
m_radioBtn->setCheckable(true);
m_radioBtn->setFixedSize(34, 30);
m_radioBtn->setCursor(Qt::PointingHandCursor);
m_radioBtn->setToolTip(QStringLiteral("Рация: включить/выключить прослушивание канала"));
m_radioBtn->setToolTip(QCoreApplication::translate("ChatGui", "Radio: toggle channel listening"));
m_radioBtn->setStyleSheet(
"QPushButton { border: 1px solid palette(mid); border-radius: 6px; background: palette(base); font-size: 15px; }"
"QPushButton:checked { background: #27ae60; border-color: #27ae60; }");
@@ -1023,17 +1024,17 @@ void MessageList::onMessageContextMenu(const QPoint& pos) {
bool downloaded = !filePath.isEmpty() && QFile::exists(filePath);
QMenu menu(m_view);
QAction* saveAct = menu.addAction(QString::fromUtf8("Сохранить в файл"));
QAction* saveAct = menu.addAction(QCoreApplication::translate("ChatGui", "Save to file"));
saveAct->setEnabled(downloaded);
QAction* dlAct = nullptr;
if (!downloaded && !isDm) dlAct = menu.addAction(QString::fromUtf8("Скачать"));
if (!downloaded && !isDm) dlAct = menu.addAction(QCoreApplication::translate("ChatGui", "Download"));
QAction* chosen = menu.exec(m_view->viewport()->mapToGlobal(pos));
if (chosen == saveAct) {
QString base = displayName;
if (base.isEmpty()) base = QFileInfo(filePath).fileName();
QString dest = QFileDialog::getSaveFileName(this, QString::fromUtf8("Сохранить файл"), base);
QString dest = QFileDialog::getSaveFileName(this, QCoreApplication::translate("ChatGui", "Save file"), base);
if (dest.isEmpty()) return;
std::thread([filePath, dest]() {
if (!QFile::copy(filePath, dest))
@@ -1063,9 +1064,9 @@ void MessageList::onMessageContextMenu(const QPoint& pos) {
void MessageList::clearDmCallRoute() {
m_callPeer = 0; m_callGroup = 0;
m_callBtn->setEnabled(false);
m_callBtn->setToolTip(QStringLiteral("Собеседник недоступен"));
m_callBtn->setToolTip(QCoreApplication::translate("ChatGui", "Peer unavailable"));
m_peerStatus->setStyleSheet("background: #E53935; border-radius: 6px;");
m_peerStatus->setToolTip(QStringLiteral("Не в сети"));
m_peerStatus->setToolTip(QCoreApplication::translate("ChatGui", "Offline"));
}
void MessageList::refreshDmCallRoute() {
@@ -1095,8 +1096,8 @@ void MessageList::onDmCallRoute(const uint8_t* data, int len) {
m_callPeer = peer; m_callGroup = group;
m_callBtn->setEnabled(peer && group);
m_peerStatus->setStyleSheet(group ? "background: #4CAF50; border-radius: 6px;" : "background: #E53935; border-radius: 6px;");
m_peerStatus->setToolTip(group ? QStringLiteral("В сети") : QStringLiteral("Не в сети"));
m_callBtn->setToolTip(group ? QStringLiteral("Позвонить") : QStringLiteral("Собеседник недоступен"));
m_peerStatus->setToolTip(group ? QCoreApplication::translate("ChatGui", "Online") : QCoreApplication::translate("ChatGui", "Offline"));
m_callBtn->setToolTip(group ? QCoreApplication::translate("ChatGui", "Call peer") : QCoreApplication::translate("ChatGui", "Peer unavailable"));
}
bool MessageList::isDmChannel(const QString& channelId) {
@@ -1155,7 +1156,7 @@ void MessageList::onDmMessages(const uint8_t* data, int len) {
const QString inviteLink = invite ? text : QString();
if (invite) {
const QString groupName = message.value("tags").toObject().value("group_name").toString();
text = tr("Приглашение в группу «%1»").arg(groupName) + '\n' + inviteLink;
text = QCoreApplication::translate("ChatGui", "Invitation to group “%1”").arg(groupName) + '\n' + inviteLink;
GUI_DEBUG("invite PM: rendered conv=%s seq=%lld group_name_bytes=%d link_bytes=%d", qPrintable(m_currentChannelId),
(long long)seq, (int)groupName.toUtf8().size(), (int)inviteLink.size());
}
@@ -1163,12 +1164,14 @@ void MessageList::onDmMessages(const uint8_t* data, int len) {
QString state = message.value("media_status").toString();
QString status;
if (file) {
if (state == "delivered") status = QString::fromUtf8("Доставлено");
else if (state == "expired") status = QString::fromUtf8("Срок хранения истёк");
else if (dir == 1) status = QString::fromUtf8("Ожидает доставки");
else if (state == "ready") status = QString::fromUtf8("Получено");
else status = QString::fromUtf8("Загрузка…");
} else if (dir == 1) status = message.value("pending").toBool() ? QString::fromUtf8("Ожидает доставки") : QString::fromUtf8("Доставлено");
if (state == "delivered") status = QCoreApplication::translate("ChatGui", "Delivered");
else if (state == "expired") status = QCoreApplication::translate("ChatGui", "Storage period expired");
else if (dir == 1) status = QCoreApplication::translate("ChatGui", "Awaiting delivery");
else if (state == "ready") status = QCoreApplication::translate("ChatGui", "Received");
else status = QCoreApplication::translate("ChatGui", "Downloading…");
} else if (dir == 1) status = message.value("pending").toBool() ? QCoreApplication::translate("ChatGui",
"Awaiting delivery") : QCoreApplication::translate("ChatGui",
"Delivered");
AccountRow acc = m_db ? m_db->getAccount(author) : AccountRow();
QString name = authorName(author);
@@ -1228,7 +1231,7 @@ void MessageList::onRadioTalk(quint64 groupId, quint64 srcNodeId, bool on) {
if (on) {
QString name = authorName(srcNodeId);
if (name.isEmpty()) name = QStringLiteral("0x%1").arg(srcNodeId, 0, 16);
m_talkingLabel->setText(QString::fromUtf8("\xF0\x9F\x8E\x99 %1 говорит").arg(name));
m_talkingLabel->setText(QCoreApplication::translate("ChatGui", "🎙 %1 is speaking").arg(name));
m_talkingLabel->show();
} else {
m_talkingLabel->hide();