mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-26 06:26:11 -05:00
Set test locale to C
This commit is contained in:
parent
aace1dc913
commit
0acb15de0f
@ -24,6 +24,7 @@
|
|||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "config-keepassx.h"
|
#include "config-keepassx.h"
|
||||||
#include "core/Bootstrap.h"
|
#include "core/Bootstrap.h"
|
||||||
|
#include "core/Config.h"
|
||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
#include "core/Tools.h"
|
#include "core/Tools.h"
|
||||||
#include "crypto/Crypto.h"
|
#include "crypto/Crypto.h"
|
||||||
@ -181,7 +182,7 @@ int main(int argc, char** argv)
|
|||||||
QCoreApplication app(argc, argv);
|
QCoreApplication app(argc, argv);
|
||||||
QCoreApplication::setApplicationVersion(KEEPASSXC_VERSION);
|
QCoreApplication::setApplicationVersion(KEEPASSXC_VERSION);
|
||||||
|
|
||||||
Bootstrap::bootstrap();
|
Bootstrap::bootstrap(config()->get(Config::GUI_Language).toString());
|
||||||
Utils::setDefaultTextStreams();
|
Utils::setDefaultTextStreams();
|
||||||
Commands::setupCommands(false);
|
Commands::setupCommands(false);
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ namespace Bootstrap
|
|||||||
* Perform early application bootstrapping that does not rely on a QApplication
|
* Perform early application bootstrapping that does not rely on a QApplication
|
||||||
* being present.
|
* being present.
|
||||||
*/
|
*/
|
||||||
void bootstrap()
|
void bootstrap(const QString& uiLanguage)
|
||||||
{
|
{
|
||||||
#ifdef QT_NO_DEBUG
|
#ifdef QT_NO_DEBUG
|
||||||
disableCoreDumps();
|
disableCoreDumps();
|
||||||
@ -72,7 +72,7 @@ namespace Bootstrap
|
|||||||
setupSearchPaths();
|
setupSearchPaths();
|
||||||
applyEarlyQNetworkAccessManagerWorkaround();
|
applyEarlyQNetworkAccessManagerWorkaround();
|
||||||
|
|
||||||
Translator::installTranslators();
|
Translator::installTranslators(uiLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// LCOV_EXCL_START
|
// LCOV_EXCL_START
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
namespace Bootstrap
|
namespace Bootstrap
|
||||||
{
|
{
|
||||||
void bootstrap();
|
void bootstrap(const QString& uiLanguage = "system");
|
||||||
void disableCoreDumps();
|
void disableCoreDumps();
|
||||||
bool createWindowsDACL();
|
bool createWindowsDACL();
|
||||||
void setupSearchPaths();
|
void setupSearchPaths();
|
||||||
|
@ -25,24 +25,22 @@
|
|||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
|
||||||
#include "core/Config.h"
|
|
||||||
#include "core/Resources.h"
|
#include "core/Resources.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install all KeePassXC and Qt translators.
|
* Install all KeePassXC and Qt translators.
|
||||||
*/
|
*/
|
||||||
void Translator::installTranslators()
|
void Translator::installTranslators(const QString& uiLanguage)
|
||||||
{
|
{
|
||||||
QStringList languages;
|
QStringList languages;
|
||||||
QString languageSetting = config()->get(Config::GUI_Language).toString();
|
if (uiLanguage.isEmpty() || uiLanguage == "system") {
|
||||||
if (languageSetting.isEmpty() || languageSetting == "system") {
|
|
||||||
// NOTE: this is a workaround for the terrible way Qt loads languages
|
// NOTE: this is a workaround for the terrible way Qt loads languages
|
||||||
// using the QLocale::uiLanguages() approach. Instead, we search each
|
// using the QLocale::uiLanguages() approach. Instead, we search each
|
||||||
// language and all country variants in order before moving to the next.
|
// language and all country variants in order before moving to the next.
|
||||||
QLocale locale;
|
QLocale locale;
|
||||||
languages = locale.uiLanguages();
|
languages = locale.uiLanguages();
|
||||||
} else {
|
} else {
|
||||||
languages << languageSetting;
|
languages << uiLanguage;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always try to load english last
|
// Always try to load english last
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
class Translator
|
class Translator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void installTranslators();
|
static void installTranslators(const QString& uiLanguage = "system");
|
||||||
static QList<QPair<QString, QString>> availableLanguages();
|
static QList<QPair<QString, QString>> availableLanguages();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -147,9 +147,9 @@ Application::~Application()
|
|||||||
* configuration OS security properties, and loading translators.
|
* configuration OS security properties, and loading translators.
|
||||||
* A QApplication object has to be instantiated before calling this function.
|
* 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
|
#ifdef Q_OS_WIN
|
||||||
// Qt on Windows uses "MS Shell Dlg 2" as the default font for many widgets, which resolves
|
// 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(int& argc, char** argv);
|
||||||
~Application() override;
|
~Application() override;
|
||||||
|
|
||||||
static void bootstrap();
|
static void bootstrap(const QString& uiLanguage = "system");
|
||||||
|
|
||||||
void applyTheme();
|
void applyTheme();
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ int main(int argc, char** argv)
|
|||||||
QGuiApplication::setDesktopFileName(app.property("KPXC_QUALIFIED_APPNAME").toString() + QStringLiteral(".desktop"));
|
QGuiApplication::setDesktopFileName(app.property("KPXC_QUALIFIED_APPNAME").toString() + QStringLiteral(".desktop"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Application::bootstrap();
|
Application::bootstrap(config()->get(Config::GUI_Language).toString());
|
||||||
|
|
||||||
MainWindow mainWindow;
|
MainWindow mainWindow;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
@ -66,6 +66,7 @@ void TestCli::initTestCase()
|
|||||||
QVERIFY(Crypto::init());
|
QVERIFY(Crypto::init());
|
||||||
|
|
||||||
Config::createTempFileInstance();
|
Config::createTempFileInstance();
|
||||||
|
QLocale::setDefault(QLocale::c());
|
||||||
Bootstrap::bootstrap();
|
Bootstrap::bootstrap();
|
||||||
|
|
||||||
m_devNull.reset(new QFile());
|
m_devNull.reset(new QFile());
|
||||||
|
@ -89,6 +89,7 @@ void TestGui::initTestCase()
|
|||||||
{
|
{
|
||||||
QVERIFY(Crypto::init());
|
QVERIFY(Crypto::init());
|
||||||
Config::createTempFileInstance();
|
Config::createTempFileInstance();
|
||||||
|
QLocale::setDefault(QLocale::c());
|
||||||
Application::bootstrap();
|
Application::bootstrap();
|
||||||
|
|
||||||
m_mainWindow.reset(new MainWindow());
|
m_mainWindow.reset(new MainWindow());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user