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

+37 -25
View File
@@ -1,3 +1,4 @@
#include <QCoreApplication>
#include "radiosettingspage.h"
#include "ptt_hotkey_manager.h"
#include "radio_audio_engine.h"
@@ -17,7 +18,7 @@
RadioSettingsPage::RadioSettingsPage(DbManager* db, QWidget* parent) : QWidget(parent), m_db(db) {
auto* layout = new QVBoxLayout(this);
auto* title = new QLabel("Рация (PTT)", this);
auto* title = new QLabel(QCoreApplication::translate("ChatGui", "Radio (PTT)"), this);
title->setStyleSheet("font-weight: bold; font-size: 13px;");
layout->addWidget(title);
m_audioSettings = new QWidget(this);
@@ -30,16 +31,20 @@ RadioSettingsPage::RadioSettingsPage(DbManager* db, QWidget* parent) : QWidget(p
form->addRow(label, spin);
return spin;
};
m_threshold = add(QStringLiteral("Порог речи VAD:"), 10, 95, QStringLiteral(" %"));
m_threshold->setToolTip(QStringLiteral("Порог вероятности речи: меньше — чувствительнее. Это не порог громкости."));
m_hangover = add(QStringLiteral("Тишина до окончания передачи:"), 50, 2000, QStringLiteral(" мс"));
m_compressor = new QCheckBox(QStringLiteral("Компрессор передачи и VAD"), m_audioSettings);
m_threshold = add(QCoreApplication::translate("ChatGui", "VAD speech threshold:"), 10, 95, QStringLiteral(" %"));
m_threshold->setToolTip(QCoreApplication::translate("ChatGui",
"Speech probability threshold: lower is more sensitive. This is not a volume threshold."));
m_hangover = add(QCoreApplication::translate("ChatGui",
"Silence before ending transmission:"), 50, 2000, QCoreApplication::translate("ChatGui",
" ms"));
m_compressor = new QCheckBox(QCoreApplication::translate("ChatGui", "Transmission and VAD compressor"), m_audioSettings);
form->addRow(m_compressor);
m_txGain = add(QStringLiteral("Max gain передачи:"), 1, 60, QStringLiteral(" dB"));
m_vadGain = add(QStringLiteral("Max gain VAD:"), 1, 60, QStringLiteral(" dB"));
auto* explanation = new QLabel(QStringLiteral("VAD включается кнопкой на панели рации. Буфер начала речи — 0,6 с. "
"Компрессор VAD имеет отдельный max gain; остальные параметры общие с компрессором передачи. "
"Скорость нарастания усиления задаётся в разделе Audio."), m_audioSettings);
m_txGain = add(QCoreApplication::translate("ChatGui", "Transmission max gain:"), 1, 60, QCoreApplication::translate("ChatGui", " dB"));
m_vadGain = add(QCoreApplication::translate("ChatGui", "VAD max gain:"), 1, 60, QCoreApplication::translate("ChatGui", " dB"));
auto* explanation = new QLabel(QCoreApplication::translate("ChatGui",
"Enable VAD using the button on the radio panel. Speech prebuffer is 0.6 s. The VAD "
"compressor has a separate maximum gain; other parameters are shared with the transmission "
"compressor. Set the gain rise rate in Audio."), m_audioSettings);
explanation->setWordWrap(true);
form->addRow(explanation);
layout->addWidget(m_audioSettings);
@@ -50,12 +55,13 @@ RadioSettingsPage::RadioSettingsPage(DbManager* db, QWidget* parent) : QWidget(p
});
loadAudioSettings();
if (PttHotkeyManager::usesPortal()) {
auto* hint = new QLabel("Глобальные хоткеи работают из любых приложений. "
"Назначьте обычную клавишу с Ctrl, Shift, Alt или Win в системном окне. "
"Изменения сохраняются системой сразу. Во время настройки передача с клавиатуры отключена.", this);
auto* hint = new QLabel(QCoreApplication::translate("ChatGui",
"Global shortcuts work from any application. Assign a regular key with Ctrl, Shift, Alt or "
"Win in the system dialog. Changes are saved by the system immediately. Keyboard "
"transmission is disabled during setup."), this);
hint->setWordWrap(true);
layout->addWidget(hint);
auto* button = new QPushButton("Задать PTT хоткеи…", this);
auto* button = new QPushButton(QCoreApplication::translate("ChatGui", "Set PTT shortcuts…"), this);
layout->addWidget(button);
m_buttons << button;
for (int i = 0; i < 3; i++) {
@@ -75,23 +81,27 @@ RadioSettingsPage::RadioSettingsPage(DbManager* db, QWidget* parent) : QWidget(p
return;
}
auto* hint = new QLabel(
"Удерживайте сочетание для передачи из любого приложения — даже когда ChatGUI не в фокусе. "
"Рация канала должна быть включена. Для записи зажмите нужные клавиши вместе и отпустите их. "
"Левые и правые Ctrl, Shift, Alt, Win различаются. Fn доступна, только если клавиатура передаёт её ОС.", this);
QCoreApplication::translate("ChatGui",
"Hold a shortcut to transmit from any application, even when ChatGUI is not focused. "
"Channel radio must be enabled. To record a shortcut, hold the desired keys together and "
"release them. Left and right Ctrl, Shift, Alt and Win are distinct. Fn is available only "
"if the keyboard reports it to the OS."), this);
hint->setWordWrap(true);
hint->setStyleSheet("color: gray; font-size: 11px;");
layout->addWidget(hint);
if (!PttHotkeyManager::isSupported()) {
auto* warn = new QLabel("Глобальные хоткеи доступны на Windows и Linux/X11. На этой платформе запись недоступна.", this);
auto* warn = new QLabel(QCoreApplication::translate("ChatGui",
"Global shortcuts are available on Windows and Linux/X11. Shortcut recording is "
"unavailable on this platform."), this);
warn->setWordWrap(true);
warn->setStyleSheet("color: #e74c3c; font-size: 12px;");
layout->addWidget(warn);
}
for (int i = 0; i < 3; i++) {
auto* row = new QHBoxLayout();
auto* button = new QPushButton(QString("Задать PTT хоткей %1").arg(i + 1), this);
auto* button = new QPushButton(QCoreApplication::translate("ChatGui", "Set PTT shortcut %1").arg(i + 1), this);
button->setEnabled(PttHotkeyManager::isSupported());
auto* clear = new QPushButton("Очистить", this);
auto* clear = new QPushButton(QCoreApplication::translate("ChatGui", "Clear"), this);
row->addWidget(button); row->addWidget(clear);
layout->addLayout(row);
auto* label = new QLabel(this);
@@ -127,13 +137,13 @@ RadioSettingsPage::~RadioSettingsPage() {
void RadioSettingsPage::startCapture(int index) {
finishCapture(false);
if (!PttHotkeyManager::instance()->beginCapture()) {
m_labels[index]->setText("Не удалось начать запись клавиш. Подробности в логе radio.");
m_labels[index]->setText(QCoreApplication::translate("ChatGui", "Failed to start key recording. See the radio log for details."));
return;
}
m_captureIndex = index;
m_capture.candidate.clear();
m_buttons[index]->setText("Отменить запись");
m_labels[index]->setText("Нажмите одну или несколько клавиш вместе…");
m_buttons[index]->setText(QCoreApplication::translate("ChatGui", "Cancel recording"));
m_labels[index]->setText(QCoreApplication::translate("ChatGui", "Press one or more keys together…"));
qApp->installEventFilter(this);
}
@@ -147,7 +157,7 @@ void RadioSettingsPage::finishCapture(bool save) {
m_captureIndex = -1;
qApp->removeEventFilter(this);
PttHotkeyManager::instance()->endCapture();
m_buttons[index]->setText(QString("Задать PTT хоткей %1").arg(index + 1));
m_buttons[index]->setText(QCoreApplication::translate("ChatGui", "Set PTT shortcut %1").arg(index + 1));
updateLabel(index);
}
@@ -223,7 +233,9 @@ void RadioSettingsPage::updatePortalLabels() {
const auto descriptions = manager->portalDescriptions();
for (int i = 0; i < m_labels.size(); i++) {
QString text = descriptions.value(i);
m_labels[i]->setText(QString("PTT хоткей %1: %2").arg(i + 1).arg(text.isEmpty() ? "Не задано" : text));
m_labels[i]->setText(QCoreApplication::translate("ChatGui",
"PTT shortcut %1: %2").arg(i + 1).arg(text.isEmpty() ? QCoreApplication::translate("ChatGui",
"Not set") : text));
}
m_portalStatus->setText(manager->portalStatus());
m_buttons[0]->setEnabled(!manager->portalBusy());