aboutsummaryrefslogtreecommitdiff
path: root/MultiMC.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'MultiMC.cpp')
-rw-r--r--MultiMC.cpp36
1 files changed, 23 insertions, 13 deletions
diff --git a/MultiMC.cpp b/MultiMC.cpp
index 17fc2e0a..7a82c642 100644
--- a/MultiMC.cpp
+++ b/MultiMC.cpp
@@ -20,8 +20,11 @@
#include "logic/news/NewsChecker.h"
+#include "logic/status/StatusChecker.h"
+
#include "logic/InstanceLauncher.h"
#include "logic/net/HttpMetaCache.h"
+#include "logic/net/URLConstants.h"
#include "logic/JavaUtils.h"
@@ -44,8 +47,6 @@ MultiMC::MultiMC(int &argc, char **argv, bool root_override)
setOrganizationName("MultiMC");
setApplicationName("MultiMC5");
- initTranslations();
-
setAttribute(Qt::AA_UseHighDpiPixmaps);
// Don't quit on hiding the last window
this->setQuitOnLastWindowClosed(false);
@@ -172,6 +173,9 @@ MultiMC::MultiMC(int &argc, char **argv, bool root_override)
// load settings
initGlobalSettings();
+ // load translations
+ initTranslations();
+
// initialize the updater
m_updateChecker.reset(new UpdateChecker());
@@ -181,6 +185,9 @@ MultiMC::MultiMC(int &argc, char **argv, bool root_override)
// initialize the news checker
m_newsChecker.reset(new NewsChecker(NEWS_RSS_URL));
+ // initialize the status checker
+ m_statusChecker.reset(new StatusChecker());
+
// and instances
auto InstDirSetting = m_settings->getSetting("InstanceDir");
m_instances.reset(new InstanceList(InstDirSetting->get().toString(), this));
@@ -234,18 +241,20 @@ MultiMC::~MultiMC()
void MultiMC::initTranslations()
{
+ QLocale locale(m_settings->get("Language").toString());
+ QLocale::setDefault(locale);
+ QLOG_INFO() << "Your language is" << locale.bcp47Name();
m_qt_translator.reset(new QTranslator());
- if (m_qt_translator->load("qt_" + QLocale::system().name(),
+ if (m_qt_translator->load("qt_" + locale.bcp47Name(),
QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
{
- std::cout << "Loading Qt Language File for "
- << QLocale::system().name().toLocal8Bit().constData() << "...";
+ QLOG_DEBUG() << "Loading Qt Language File for"
+ << locale.bcp47Name().toLocal8Bit().constData() << "...";
if (!installTranslator(m_qt_translator.get()))
{
- std::cout << " failed.";
+ QLOG_ERROR() << "Loading Qt Language File failed.";
m_qt_translator.reset();
}
- std::cout << std::endl;
}
else
{
@@ -253,17 +262,15 @@ void MultiMC::initTranslations()
}
m_mmc_translator.reset(new QTranslator());
- if (m_mmc_translator->load("mmc_" + QLocale::system().name(),
- QDir("translations").absolutePath()))
+ if (m_mmc_translator->load("mmc_" + locale.bcp47Name(), MMC->root() + "/translations"))
{
- std::cout << "Loading MMC Language File for "
- << QLocale::system().name().toLocal8Bit().constData() << "...";
+ QLOG_DEBUG() << "Loading MMC Language File for"
+ << locale.bcp47Name().toLocal8Bit().constData() << "...";
if (!installTranslator(m_mmc_translator.get()))
{
- std::cout << " failed.";
+ QLOG_ERROR() << "Loading MMC Language File failed.";
m_mmc_translator.reset();
}
- std::cout << std::endl;
}
else
{
@@ -366,6 +373,9 @@ void MultiMC::initGlobalSettings()
// Editors
m_settings->registerSetting("JsonEditor", QString());
+ // Language
+ m_settings->registerSetting("Language", QLocale(QLocale::system().language()).bcp47Name());
+
// Console
m_settings->registerSetting("ShowConsole", true);
m_settings->registerSetting("AutoCloseConsole", true);