mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Set test locale to C
This commit is contained in:
parent
aace1dc913
commit
0acb15de0f
@ -24,6 +24,7 @@
|
||||
#include "Utils.h"
|
||||
#include "config-keepassx.h"
|
||||
#include "core/Bootstrap.h"
|
||||
#include "core/Config.h"
|
||||
#include "core/Metadata.h"
|
||||
#include "core/Tools.h"
|
||||
#include "crypto/Crypto.h"
|
||||
@ -181,7 +182,7 @@ int main(int argc, char** argv)
|
||||
QCoreApplication app(argc, argv);
|
||||
QCoreApplication::setApplicationVersion(KEEPASSXC_VERSION);
|
||||
|
||||
Bootstrap::bootstrap();
|
||||
Bootstrap::bootstrap(config()->get(Config::GUI_Language).toString());
|
||||
Utils::setDefaultTextStreams();
|
||||
Commands::setupCommands(false);
|
||||
|
||||
|
@ -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
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
namespace Bootstrap
|
||||
{
|
||||
void bootstrap();
|
||||
void bootstrap(const QString& uiLanguage = "system");
|
||||
void disableCoreDumps();
|
||||
bool createWindowsDACL();
|
||||
void setupSearchPaths();
|
||||
|
@ -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
|
||||
|
@ -24,7 +24,7 @@
|
||||
class Translator
|
||||
{
|
||||
public:
|
||||
static void installTranslators();
|
||||
static void installTranslators(const QString& uiLanguage = "system");
|
||||
static QList<QPair<QString, QString>> availableLanguages();
|
||||
|
||||
private:
|
||||
|
@ -147,9 +147,9 @@ Application::~Application()
|
||||
* configuration OS security properties, and loading translators.
|
||||
* A QApplication object has to be instantiated before calling this function.
|
||||
*/
|
||||
void Application::bootstrap()
|
||||
void Application::bootstrap(const QString& uiLanguage)
|
||||
{
|
||||
Bootstrap::bootstrap();
|
||||
Bootstrap::bootstrap(uiLanguage);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
// Qt on Windows uses "MS Shell Dlg 2" as the default font for many widgets, which resolves
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
Application(int& argc, char** argv);
|
||||
~Application() override;
|
||||
|
||||
static void bootstrap();
|
||||
static void bootstrap(const QString& uiLanguage = "system");
|
||||
|
||||
void applyTheme();
|
||||
|
||||
|
@ -176,7 +176,7 @@ int main(int argc, char** argv)
|
||||
QGuiApplication::setDesktopFileName(app.property("KPXC_QUALIFIED_APPNAME").toString() + QStringLiteral(".desktop"));
|
||||
#endif
|
||||
|
||||
Application::bootstrap();
|
||||
Application::bootstrap(config()->get(Config::GUI_Language).toString());
|
||||
|
||||
MainWindow mainWindow;
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -66,6 +66,7 @@ void TestCli::initTestCase()
|
||||
QVERIFY(Crypto::init());
|
||||
|
||||
Config::createTempFileInstance();
|
||||
QLocale::setDefault(QLocale::c());
|
||||
Bootstrap::bootstrap();
|
||||
|
||||
m_devNull.reset(new QFile());
|
||||
|
@ -89,6 +89,7 @@ void TestGui::initTestCase()
|
||||
{
|
||||
QVERIFY(Crypto::init());
|
||||
Config::createTempFileInstance();
|
||||
QLocale::setDefault(QLocale::c());
|
||||
Application::bootstrap();
|
||||
|
||||
m_mainWindow.reset(new MainWindow());
|
||||
|
Loading…
Reference in New Issue
Block a user