feat: expose language settings, populate a basic spanish translation

This commit is contained in:
sithlord48 2025-10-18 01:39:59 -04:00 committed by Chris Rizzitello
parent c3f0b18df6
commit 2d7174c3b2
6 changed files with 1326 additions and 17 deletions

View file

@ -64,6 +64,9 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
// Ensure the I18N object is made before strings
QTextStream(stdout) << "initial language: " << I18N::currentLanguage();
// Add Command Line Options
auto helpOption = QCommandLineOption({"h", "help"}, "Display Help on the command line");
auto versionOption = QCommandLineOption({"v", "version"}, "Display version information");

View file

@ -125,8 +125,8 @@ void FingerprintDialog::togglePreviewMode(bool hashMode)
void FingerprintDialog::updateModeButton(bool hashMode) const
{
const auto text = tr("Show %1").arg(hashMode ? "Image" : "Hash");
const auto toolTip = tr("Display the fingerprint as %1").arg(hashMode ? "an image" : "a hash");
const auto text = hashMode ? tr("Show image") : tr("Show hash");
const auto toolTip = hashMode ? tr("Display the fingerprint as an image") : tr("Display the fingerprint as a hash");
m_buttonBox->button(QDialogButtonBox::Help)->setText(text);
m_buttonBox->button(QDialogButtonBox::Help)->setToolTip(toolTip);
}

View file

@ -9,12 +9,14 @@
#include "SettingsDialog.h"
#include "ui_SettingsDialog.h"
#include "common/I18N.h"
#include "common/Settings.h"
#include "gui/Messages.h"
#include "gui/core/CoreProcess.h"
#include "gui/tls/TlsCertificate.h"
#include "gui/tls/TlsUtility.h"
#include <QComboBox>
#include <QDir>
#include <QFileDialog>
#include <QMessageBox>
@ -31,6 +33,11 @@ SettingsDialog::SettingsDialog(QWidget *parent, const IServerConfig &serverConfi
ui->setupUi(this);
// set up the language combo
I18N::reDetectLanguages();
ui->comboLanguage->addItems(I18N::detectedLanguages());
ui->comboLanguage->setCurrentText(I18N::currentLanguage());
// Set Tooltip for the logLevel Items
ui->comboLogLevel->setItemData(0, tr("Required messages"), Qt::ToolTipRole);
ui->comboLogLevel->setItemData(1, tr("Non-fatal errors"), Qt::ToolTipRole);
@ -77,6 +84,7 @@ void SettingsDialog::initConnections() const
connect(ui->btnBrowseLog, &QPushButton::clicked, this, &SettingsDialog::browseLogPath);
connect(ui->cbLogToFile, &QCheckBox::toggled, this, &SettingsDialog::setLogToFile);
connect(ui->comboLogLevel, &QComboBox::currentIndexChanged, this, &SettingsDialog::logLevelChanged);
connect(ui->comboLanguage, &QComboBox::currentTextChanged, I18N::instance(), &I18N::setLanguage);
}
void SettingsDialog::regenCertificates()
@ -154,6 +162,7 @@ void SettingsDialog::accept()
Settings::setValue(Settings::Gui::SymbolicTrayIcon, ui->rbIconMono->isChecked());
Settings::setValue(Settings::Security::CheckPeers, ui->cbRequireClientCert->isChecked());
Settings::setValue(Settings::Client::ScrollSpeed, ui->sbScrollSpeed->value());
Settings::setValue(Settings::Core::Language, ui->comboLanguage->currentText());
Settings::ProcessMode mode;
if (ui->groupService->isChecked())

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>549</width>
<height>611</height>
<height>628</height>
</rect>
</property>
<property name="windowTitle">
@ -32,10 +32,7 @@
<attribute name="title">
<string>&amp;Regular</string>
</attribute>
<layout class="QVBoxLayout" name="_8">
<property name="spacing">
<number>15</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="groupClientOptions">
<property name="sizePolicy">
@ -106,11 +103,11 @@
<property name="title">
<string>App</string>
</property>
<layout class="QVBoxLayout" name="_9">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="cbAutoUpdate">
<property name="text">
<string>Check for updates on startup </string>
<string>Check for updates on startup</string>
</property>
</widget>
</item>
@ -337,13 +334,7 @@
<attribute name="title">
<string>&amp;Advanced</string>
</attribute>
<layout class="QVBoxLayout" name="_2">
<property name="spacing">
<number>15</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QGroupBox" name="groupNetworking">
<property name="sizePolicy">
@ -638,6 +629,31 @@
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="widgetLanguage" native="true">
<property name="toolTip">
<string>Force a language to be used for the GUI.</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="lblLanguage">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Language</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboLanguage"/>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@ -651,6 +667,11 @@
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="widgetLangControls" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_2"/>
</widget>
</item>
</layout>
</widget>
</widget>
@ -668,7 +689,6 @@
</layout>
</widget>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>cbLanguageSync</tabstop>
<tabstop>cbScrollDirection</tabstop>
<tabstop>cbAutoUpdate</tabstop>

View file

@ -21,6 +21,7 @@ NewScreenWidget::NewScreenWidget(QWidget *parent) : QLabel(parent)
void NewScreenWidget::mousePressEvent(QMouseEvent *event)
{
//: Used as the hostname. Translation may not contain spaces
Screen newScreen(tr("Unnamed"));
QByteArray itemData;

1276
translations/deskflow_es.ts Normal file

File diff suppressed because it is too large Load diff