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

+21 -15
View File
@@ -1,3 +1,4 @@
#include <QCoreApplication>
// nodespage.cpp — Nodes table + dump in settings
#include "nodespage.h"
#include "../db/db_manager.h"
@@ -59,12 +60,15 @@ NodesPage::NodesPage(DbManager* db, QWidget* parent)
layout->setSpacing(8);
layout->setContentsMargins(0, 0, 0, 0);
auto* title = new QLabel("Known Nodes", this);
auto* title = new QLabel(QCoreApplication::translate("ChatGui", "Known Nodes"), this);
title->setStyleSheet("font-weight: bold; font-size: 13px;");
layout->addWidget(title);
m_table = new QTableWidget(0, 5, this);
m_table->setHorizontalHeaderLabels({"Node ID", "Name", "x25519", "ed25519", "Addrs"});
m_table->setHorizontalHeaderLabels({QCoreApplication::translate("ChatGui",
"Node ID"), QCoreApplication::translate("ChatGui",
"Name"), "x25519", "ed25519", QCoreApplication::translate("ChatGui",
"Addrs")});
m_table->horizontalHeader()->setStretchLastSection(true);
m_table->setSelectionBehavior(QAbstractItemView::SelectRows);
m_table->setSelectionMode(QAbstractItemView::SingleSelection);
@@ -78,7 +82,7 @@ NodesPage::NodesPage(DbManager* db, QWidget* parent)
" font-weight: bold; font-size: 9px; }");
layout->addWidget(m_table, 2);
auto* dumpLabel = new QLabel("Details", this);
auto* dumpLabel = new QLabel(QCoreApplication::translate("ChatGui", "Details"), this);
dumpLabel->setStyleSheet("font-weight: bold; font-size: 12px; margin-top: 8px;");
layout->addWidget(dumpLabel);
@@ -88,13 +92,13 @@ NodesPage::NodesPage(DbManager* db, QWidget* parent)
m_dumpText->setStyleSheet(
"QPlainTextEdit { border: 1px solid palette(mid); border-radius: 4px;"
" padding: 8px; background: palette(base); }");
m_dumpText->setPlaceholderText("Click Refresh to load nodes");
m_dumpText->setPlaceholderText(QCoreApplication::translate("ChatGui", "Click Refresh to load nodes"));
layout->addWidget(m_dumpText, 3);
auto* btnLayout = new QHBoxLayout();
btnLayout->addStretch();
m_refreshBtn = new QPushButton("Refresh", this);
m_refreshBtn->setFixedWidth(90);
m_refreshBtn = new QPushButton(QCoreApplication::translate("ChatGui", "Refresh"), this);
m_refreshBtn->setMinimumWidth(90);
m_refreshBtn->setStyleSheet(
"QPushButton { border: 1px solid palette(mid); border-radius: 4px;"
" padding: 6px 16px; font-size: 13px; background: palette(button); }"
@@ -109,7 +113,7 @@ void NodesPage::onRefreshClicked() { refreshNodes(); }
void NodesPage::refreshNodes() {
if (!m_db || !m_db->m_db) {
m_table->setRowCount(0);
m_dumpText->setPlainText(QString("Database not connected (m_db=%1, m_db->m_db=%2)")
m_dumpText->setPlainText(QCoreApplication::translate("ChatGui", "Database not connected (m_db=%1, m_db->m_db=%2)")
.arg((quintptr)m_db, 0, 16).arg(m_db ? (quintptr)m_db->m_db : 0, 0, 16));
qWarning("NodesPage::refreshNodes: DB not ready m_db=%p m_db->m_db=%p", (void*)m_db, m_db ? (void*)m_db->m_db : nullptr);
return;
@@ -167,7 +171,7 @@ void NodesPage::refreshNodes() {
"SELECT node_id, name, x25519_pubkey, ed25519_pubkey,"
" last_seen_at, created_at FROM nodes ORDER BY node_id",
-1, &st, nullptr);
if (!st) { m_dumpText->setPlainText("Query error"); return; }
if (!st) { m_dumpText->setPlainText(QCoreApplication::translate("ChatGui", "Query error")); return; }
int nodeCount = 0;
while (sqlite3_step(st) == SQLITE_ROW) {
@@ -181,15 +185,17 @@ void NodesPage::refreshNodes() {
qint64 last_seen = sqlite3_column_int64(st, 4);
qint64 created = sqlite3_column_int64(st, 5);
dump += QString("Node: %1").arg(hex16(nid));
dump += QCoreApplication::translate("ChatGui", "Node: %1").arg(hex16(nid));
if (!name.isEmpty()) dump += QString(" (%1)").arg(name);
dump += QString(" id=0x%1\n").arg(nid, 16, 16, QChar('0'));
dump += QString(" x25519: %1\n").arg(x25.isEmpty() ? "-" : shortenKey(x25));
dump += QString(" ed25519: %1\n").arg(ed.isEmpty() ? "-" : shortenKey(ed));
if (last_seen > 0)
dump += QString(" last_seen: %1\n").arg(QDateTime::fromSecsSinceEpoch(last_seen).toString("yyyy-MM-dd hh:mm:ss"));
dump += QCoreApplication::translate("ChatGui",
" last seen: %1\n").arg(QDateTime::fromSecsSinceEpoch(last_seen).toString("yyyy-MM-dd hh:mm:ss"));
if (created > 0)
dump += QString(" created: %1\n").arg(QDateTime::fromSecsSinceEpoch(created).toString("yyyy-MM-dd hh:mm:ss"));
dump += QCoreApplication::translate("ChatGui",
" created: %1\n").arg(QDateTime::fromSecsSinceEpoch(created).toString("yyyy-MM-dd hh:mm:ss"));
sqlite3_stmt* na = nullptr;
sqlite3_prepare_v2(d,
@@ -200,7 +206,7 @@ void NodesPage::refreshNodes() {
sqlite3_bind_int64(na, 1, (sqlite3_int64)nid);
int ac = 0;
while (sqlite3_step(na) == SQLITE_ROW) {
if (ac == 0) dump += " addresses:\n";
if (ac == 0) dump += QCoreApplication::translate("ChatGui", " addresses:\n");
int family = sqlite3_column_int(na, 0);
int proto = sqlite3_column_int(na, 1);
const void* addr = sqlite3_column_blob(na, 2);
@@ -219,14 +225,14 @@ void NodesPage::refreshNodes() {
}
ac++;
}
if (ac == 0) dump += " addresses: none\n";
if (ac == 0) dump += QCoreApplication::translate("ChatGui", " addresses: none\n");
sqlite3_finalize(na);
} else {
dump += " addresses: none\n";
dump += QCoreApplication::translate("ChatGui", " addresses: none\n");
}
}
sqlite3_finalize(st);
if (nodeCount == 0) dump = "No nodes found.";
if (nodeCount == 0) dump = QCoreApplication::translate("ChatGui", "No nodes found.");
m_dumpText->setPlainText(dump);
}