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>
|
||||
// databasesettingspage.cpp — Database maintenance page in settings
|
||||
#include "databasesettingspage.h"
|
||||
#include "../db/db_manager.h"
|
||||
@@ -17,7 +18,7 @@ DatabaseSettingsPage::DatabaseSettingsPage(DbManager* db, QWidget* parent)
|
||||
layout->setSpacing(10);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
auto* title = new QLabel("Database Maintenance", this);
|
||||
auto* title = new QLabel(QCoreApplication::translate("ChatGui", "Database Maintenance"), this);
|
||||
title->setStyleSheet("font-weight: bold; font-size: 13px;");
|
||||
layout->addWidget(title);
|
||||
|
||||
@@ -35,29 +36,29 @@ DatabaseSettingsPage::DatabaseSettingsPage(DbManager* db, QWidget* parent)
|
||||
QFileInfo fi(dbPath);
|
||||
if (fi.exists()) {
|
||||
qint64 sz = fi.size();
|
||||
if (sz < 1024) dbSize = QString("%1 B").arg(sz);
|
||||
else if (sz < 1024 * 1024) dbSize = QString("%1 KB").arg(sz / 1024);
|
||||
else dbSize = QString("%1 MB").arg(sz / (1024.0 * 1024.0), 0, 'f', 2);
|
||||
if (sz < 1024) dbSize = QCoreApplication::translate("ChatGui", "%1 B").arg(sz);
|
||||
else if (sz < 1024 * 1024) dbSize = QCoreApplication::translate("ChatGui", "%1 KB").arg(sz / 1024);
|
||||
else dbSize = QCoreApplication::translate("ChatGui", "%1 MB").arg(sz / (1024.0 * 1024.0), 0, 'f', 2);
|
||||
}
|
||||
QFileInfo walFi(dbPath + "-wal");
|
||||
if (walFi.exists()) {
|
||||
qint64 wsz = walFi.size();
|
||||
if (wsz < 1024) walSize = QString("%1 B").arg(wsz);
|
||||
else if (wsz < 1024 * 1024) walSize = QString("%1 KB").arg(wsz / 1024);
|
||||
else walSize = QString("%1 MB").arg(wsz / (1024.0 * 1024.0), 0, 'f', 2);
|
||||
if (wsz < 1024) walSize = QCoreApplication::translate("ChatGui", "%1 B").arg(wsz);
|
||||
else if (wsz < 1024 * 1024) walSize = QCoreApplication::translate("ChatGui", "%1 KB").arg(wsz / 1024);
|
||||
else walSize = QCoreApplication::translate("ChatGui", "%1 MB").arg(wsz / (1024.0 * 1024.0), 0, 'f', 2);
|
||||
} else {
|
||||
walSize = "n/a";
|
||||
walSize = QCoreApplication::translate("ChatGui", "n/a");
|
||||
}
|
||||
}
|
||||
}
|
||||
m_filePathLabel = new QLabel(dbPath, this);
|
||||
m_filePathLabel->setStyleSheet("font-size: 11px; color: gray;");
|
||||
m_filePathLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||
infoLayout->addRow("File:", m_filePathLabel);
|
||||
infoLayout->addRow(QCoreApplication::translate("ChatGui", "File:"), m_filePathLabel);
|
||||
|
||||
m_fileSizeLabel = new QLabel(dbSize, this);
|
||||
m_fileSizeLabel->setStyleSheet("font-size: 11px;");
|
||||
infoLayout->addRow("Size:", m_fileSizeLabel);
|
||||
infoLayout->addRow(QCoreApplication::translate("ChatGui", "Size:"), m_fileSizeLabel);
|
||||
|
||||
m_walSizeLabel = new QLabel(walSize, this);
|
||||
m_walSizeLabel->setStyleSheet("font-size: 11px;");
|
||||
@@ -76,34 +77,34 @@ DatabaseSettingsPage::DatabaseSettingsPage(DbManager* db, QWidget* parent)
|
||||
btnLayout->setSpacing(6);
|
||||
|
||||
auto* quickRow = new QHBoxLayout();
|
||||
m_quickBtn = new QPushButton("Quick Check", this);
|
||||
m_quickBtn = new QPushButton(QCoreApplication::translate("ChatGui", "Quick Check"), this);
|
||||
m_quickBtn->setStyleSheet(
|
||||
"QPushButton { border: 1px solid palette(mid); border-radius: 4px;"
|
||||
" padding: 5px 14px; font-size: 12px; background: palette(button); }"
|
||||
"QPushButton:hover { background: palette(light); }");
|
||||
connect(m_quickBtn, &QPushButton::clicked, this, &DatabaseSettingsPage::onQuickCheck);
|
||||
quickRow->addWidget(m_quickBtn);
|
||||
auto* quickDesc = new QLabel("Scans structure without verifying indexes (fast)", this);
|
||||
auto* quickDesc = new QLabel(QCoreApplication::translate("ChatGui", "Scans structure without verifying indexes (fast)"), this);
|
||||
quickDesc->setStyleSheet("color: gray; font-size: 11px;");
|
||||
quickRow->addWidget(quickDesc, 1);
|
||||
btnLayout->addLayout(quickRow);
|
||||
|
||||
auto* fullRow = new QHBoxLayout();
|
||||
m_fullBtn = new QPushButton("Full Check", this);
|
||||
m_fullBtn = new QPushButton(QCoreApplication::translate("ChatGui", "Full Check"), this);
|
||||
m_fullBtn->setStyleSheet(m_quickBtn->styleSheet());
|
||||
connect(m_fullBtn, &QPushButton::clicked, this, &DatabaseSettingsPage::onFullCheck);
|
||||
fullRow->addWidget(m_fullBtn);
|
||||
auto* fullDesc = new QLabel("Verifies all data structures and indexes (thorough)", this);
|
||||
auto* fullDesc = new QLabel(QCoreApplication::translate("ChatGui", "Verifies all data structures and indexes (thorough)"), this);
|
||||
fullDesc->setStyleSheet("color: gray; font-size: 11px;");
|
||||
fullRow->addWidget(fullDesc, 1);
|
||||
btnLayout->addLayout(fullRow);
|
||||
|
||||
auto* optRow = new QHBoxLayout();
|
||||
m_optimizeBtn = new QPushButton("Optimize", this);
|
||||
m_optimizeBtn = new QPushButton(QCoreApplication::translate("ChatGui", "Optimize"), this);
|
||||
m_optimizeBtn->setStyleSheet(m_quickBtn->styleSheet());
|
||||
connect(m_optimizeBtn, &QPushButton::clicked, this, &DatabaseSettingsPage::onOptimize);
|
||||
optRow->addWidget(m_optimizeBtn);
|
||||
auto* optDesc = new QLabel("Update query planner statistics for better performance", this);
|
||||
auto* optDesc = new QLabel(QCoreApplication::translate("ChatGui", "Update query planner statistics for better performance"), this);
|
||||
optDesc->setStyleSheet("color: gray; font-size: 11px;");
|
||||
optRow->addWidget(optDesc, 1);
|
||||
btnLayout->addLayout(optRow);
|
||||
@@ -123,13 +124,13 @@ DatabaseSettingsPage::DatabaseSettingsPage(DbManager* db, QWidget* parent)
|
||||
"QPlainTextEdit { font-family: monospace; font-size: 11px;"
|
||||
" background: palette(base); border: 1px solid palette(mid); border-radius: 4px;"
|
||||
" padding: 4px; }");
|
||||
m_resultText->setPlaceholderText("Run a check to see results...");
|
||||
m_resultText->setPlaceholderText(QCoreApplication::translate("ChatGui", "Run a check to see results..."));
|
||||
layout->addWidget(m_resultText);
|
||||
|
||||
layout->addStretch();
|
||||
|
||||
if (!m_db || !m_db->m_db) {
|
||||
m_statusLabel->setText("Database not connected");
|
||||
m_statusLabel->setText(QCoreApplication::translate("ChatGui", "Database not connected"));
|
||||
m_statusLabel->setStyleSheet("font-size: 12px; font-weight: bold; color: red;");
|
||||
m_quickBtn->setEnabled(false);
|
||||
m_fullBtn->setEnabled(false);
|
||||
@@ -140,7 +141,7 @@ DatabaseSettingsPage::DatabaseSettingsPage(DbManager* db, QWidget* parent)
|
||||
|
||||
void DatabaseSettingsPage::refreshStatus() {
|
||||
if (!m_db || !m_db->m_db) {
|
||||
m_statusLabel->setText("Database not connected");
|
||||
m_statusLabel->setText(QCoreApplication::translate("ChatGui", "Database not connected"));
|
||||
m_statusLabel->setStyleSheet("font-size: 12px; font-weight: bold; color: red;");
|
||||
m_quickBtn->setEnabled(false);
|
||||
m_fullBtn->setEnabled(false);
|
||||
@@ -157,16 +158,16 @@ void DatabaseSettingsPage::refreshStatus() {
|
||||
QFileInfo fi(dbPath);
|
||||
if (fi.exists()) {
|
||||
qint64 sz = fi.size();
|
||||
if (sz < 1024) m_fileSizeLabel->setText(QString("%1 B").arg(sz));
|
||||
else if (sz < 1024 * 1024) m_fileSizeLabel->setText(QString("%1 KB").arg(sz / 1024));
|
||||
else m_fileSizeLabel->setText(QString("%1 MB").arg(sz / (1024.0 * 1024.0), 0, 'f', 2));
|
||||
if (sz < 1024) m_fileSizeLabel->setText(QCoreApplication::translate("ChatGui", "%1 B").arg(sz));
|
||||
else if (sz < 1024 * 1024) m_fileSizeLabel->setText(QCoreApplication::translate("ChatGui", "%1 KB").arg(sz / 1024));
|
||||
else m_fileSizeLabel->setText(QCoreApplication::translate("ChatGui", "%1 MB").arg(sz / (1024.0 * 1024.0), 0, 'f', 2));
|
||||
QFileInfo walFi(dbPath + "-wal");
|
||||
if (walFi.exists()) {
|
||||
qint64 wsz = walFi.size();
|
||||
if (wsz < 1024) m_walSizeLabel->setText(QString("%1 B").arg(wsz));
|
||||
else if (wsz < 1024 * 1024) m_walSizeLabel->setText(QString("%1 KB").arg(wsz / 1024));
|
||||
else m_walSizeLabel->setText(QString("%1 MB").arg(wsz / (1024.0 * 1024.0), 0, 'f', 2));
|
||||
} else { m_walSizeLabel->setText("n/a"); }
|
||||
if (wsz < 1024) m_walSizeLabel->setText(QCoreApplication::translate("ChatGui", "%1 B").arg(wsz));
|
||||
else if (wsz < 1024 * 1024) m_walSizeLabel->setText(QCoreApplication::translate("ChatGui", "%1 KB").arg(wsz / 1024));
|
||||
else m_walSizeLabel->setText(QCoreApplication::translate("ChatGui", "%1 MB").arg(wsz / (1024.0 * 1024.0), 0, 'f', 2));
|
||||
} else { m_walSizeLabel->setText(QCoreApplication::translate("ChatGui", "n/a")); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,47 +177,47 @@ void DatabaseSettingsPage::setBusy(bool busy) {
|
||||
m_fullBtn->setEnabled(!busy);
|
||||
m_optimizeBtn->setEnabled(!busy);
|
||||
if (busy) {
|
||||
m_statusLabel->setText("Checking...");
|
||||
m_statusLabel->setText(QCoreApplication::translate("ChatGui", "Checking..."));
|
||||
m_statusLabel->setStyleSheet("font-size: 12px; margin-top: 4px; color: gray;");
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseSettingsPage::onQuickCheck() {
|
||||
if (!m_db || !m_db->m_db) {
|
||||
m_statusLabel->setText("Database not open");
|
||||
m_statusLabel->setText(QCoreApplication::translate("ChatGui", "Database not open"));
|
||||
m_statusLabel->setStyleSheet("font-size: 12px; color: red;");
|
||||
return;
|
||||
}
|
||||
setBusy(true);
|
||||
QTimer::singleShot(50, this, [this]() {
|
||||
IntegrityResult r = m_db->integrityCheckQuick();
|
||||
showResult("Quick Check", r);
|
||||
showResult(QCoreApplication::translate("ChatGui", "Quick Check"), r);
|
||||
});
|
||||
}
|
||||
|
||||
void DatabaseSettingsPage::onFullCheck() {
|
||||
if (!m_db || !m_db->m_db) {
|
||||
m_statusLabel->setText("Database not open");
|
||||
m_statusLabel->setText(QCoreApplication::translate("ChatGui", "Database not open"));
|
||||
m_statusLabel->setStyleSheet("font-size: 12px; color: red;");
|
||||
return;
|
||||
}
|
||||
setBusy(true);
|
||||
QTimer::singleShot(50, this, [this]() {
|
||||
IntegrityResult r = m_db->integrityCheckFull();
|
||||
showResult("Full Check", r);
|
||||
showResult(QCoreApplication::translate("ChatGui", "Full Check"), r);
|
||||
});
|
||||
}
|
||||
|
||||
void DatabaseSettingsPage::onOptimize() {
|
||||
if (!m_db || !m_db->m_db) {
|
||||
m_statusLabel->setText("Database not open");
|
||||
m_statusLabel->setText(QCoreApplication::translate("ChatGui", "Database not open"));
|
||||
m_statusLabel->setStyleSheet("font-size: 12px; color: red;");
|
||||
return;
|
||||
}
|
||||
setBusy(true);
|
||||
QTimer::singleShot(50, this, [this]() {
|
||||
IntegrityResult r = m_db->integrityOptimize();
|
||||
showResult("Optimize", r);
|
||||
showResult(QCoreApplication::translate("ChatGui", "Optimize"), r);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -226,11 +227,11 @@ void DatabaseSettingsPage::showResult(const QString& checkName, const IntegrityR
|
||||
m_optimizeBtn->setEnabled(true);
|
||||
|
||||
if (result.ok) {
|
||||
m_statusLabel->setText(QString("%1: OK (%2 ms)")
|
||||
m_statusLabel->setText(QCoreApplication::translate("ChatGui", "%1: OK (%2 ms)")
|
||||
.arg(checkName).arg(result.elapsedMs));
|
||||
m_statusLabel->setStyleSheet("font-size: 12px; font-weight: bold; color: green;");
|
||||
} else {
|
||||
m_statusLabel->setText(QString("%1: FAILED (%2 ms)")
|
||||
m_statusLabel->setText(QCoreApplication::translate("ChatGui", "%1: FAILED (%2 ms)")
|
||||
.arg(checkName).arg(result.elapsedMs));
|
||||
m_statusLabel->setStyleSheet("font-size: 12px; font-weight: bold; color: red;");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user