Set test locale to C

This commit is contained in:
Janek Bevendorff
2024-03-07 23:09:00 +01:00
committed by Jonathan White
parent aace1dc913
commit 0acb15de0f
10 changed files with 15 additions and 14 deletions

View File

@@ -63,7 +63,7 @@ namespace Bootstrap
* Perform early application bootstrapping that does not rely on a QApplication
* being present.
*/
void bootstrap()
void bootstrap(const QString& uiLanguage)
{
#ifdef QT_NO_DEBUG
disableCoreDumps();
@@ -72,7 +72,7 @@ namespace Bootstrap
setupSearchPaths();
applyEarlyQNetworkAccessManagerWorkaround();
Translator::installTranslators();
Translator::installTranslators(uiLanguage);
}
// LCOV_EXCL_START

View File

@@ -22,7 +22,7 @@
namespace Bootstrap
{
void bootstrap();
void bootstrap(const QString& uiLanguage = "system");
void disableCoreDumps();
bool createWindowsDACL();
void setupSearchPaths();

View File

@@ -25,24 +25,22 @@
#include <QRegularExpression>
#include <QTranslator>
#include "core/Config.h"
#include "core/Resources.h"
/**
* Install all KeePassXC and Qt translators.
*/
void Translator::installTranslators()
void Translator::installTranslators(const QString& uiLanguage)
{
QStringList languages;
QString languageSetting = config()->get(Config::GUI_Language).toString();
if (languageSetting.isEmpty() || languageSetting == "system") {
if (uiLanguage.isEmpty() || uiLanguage == "system") {
// NOTE: this is a workaround for the terrible way Qt loads languages
// using the QLocale::uiLanguages() approach. Instead, we search each
// language and all country variants in order before moving to the next.
QLocale locale;
languages = locale.uiLanguages();
} else {
languages << languageSetting;
languages << uiLanguage;
}
// Always try to load english last

View File

@@ -24,7 +24,7 @@
class Translator
{
public:
static void installTranslators();
static void installTranslators(const QString& uiLanguage = "system");
static QList<QPair<QString, QString>> availableLanguages();
private: