Ursprung
e4666e3fae
Commit
12e23c90a9
@ -25,6 +25,7 @@
|
||||
#include <QSettings>
|
||||
#endif
|
||||
#include <QCommandLineParser>
|
||||
#include <QMessageBox>
|
||||
#include <version.hpp>
|
||||
#include "mainwindow.hpp"
|
||||
#include "settings/generalsettings.hpp"
|
||||
@ -100,15 +101,25 @@ int main(int argc, char* argv[])
|
||||
const bool logMissingStrings = !DeveloperSettings::instance().logMissingStringsDir.value().isEmpty();
|
||||
|
||||
const auto localePath = getLocalePath();
|
||||
Locale::instance = std::make_unique<Locale>(localePath / "neutral.lang");
|
||||
if(language != languageDefault && !DeveloperSettings::instance().dontLoadFallbackLanguage)
|
||||
try
|
||||
{
|
||||
Locale::instance = std::make_unique<Locale>(localePath / languageDefault.toStdString().append(".lang"), std::move(Locale::instance));
|
||||
if(logMissingStrings)
|
||||
const_cast<Locale*>(Locale::instance.get())->enableMissingLogging();
|
||||
Locale::instance = std::make_unique<Locale>(localePath / "neutral.lang");
|
||||
|
||||
if(language != languageDefault && !DeveloperSettings::instance().dontLoadFallbackLanguage)
|
||||
{
|
||||
Locale::instance = std::make_unique<Locale>(localePath / languageDefault.toStdString().append(".lang"), std::move(Locale::instance));
|
||||
if(logMissingStrings)
|
||||
const_cast<Locale*>(Locale::instance.get())->enableMissingLogging();
|
||||
}
|
||||
|
||||
Locale::instance = std::make_unique<Locale>(localePath / language.toStdString().append(".lang"), std::move(Locale::instance));
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
QMessageBox::critical(nullptr, "Error", QString::fromLatin1(e.what()));
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
Locale::instance = std::make_unique<Locale>(localePath / language.toStdString().append(".lang"), std::move(Locale::instance));
|
||||
if(logMissingStrings)
|
||||
const_cast<Locale*>(Locale::instance.get())->enableMissingLogging();
|
||||
|
||||
|
||||
@ -87,7 +87,15 @@ int main(int argc, char* argv[])
|
||||
#endif
|
||||
|
||||
const auto localePath = getLocalePath();
|
||||
Locale::instance = std::make_unique<Locale>(localePath / "en-us.lang", std::make_unique<Locale>(localePath / "neutral.lang"));
|
||||
try
|
||||
{
|
||||
Locale::instance = std::make_unique<Locale>(localePath / "en-us.lang", std::make_unique<Locale>(localePath / "neutral.lang"));
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
std::cerr << e.what() << std::endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if(enableConsoleLogger)
|
||||
Log::enableConsoleLogger();
|
||||
|
||||
@ -61,6 +61,10 @@ Locale::Locale(std::filesystem::path _filename, std::unique_ptr<const Locale> fa
|
||||
p += 4 - (len % 4);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error(std::string("Failed loading language file: ").append(filename.string()));
|
||||
}
|
||||
}
|
||||
|
||||
void Locale::enableMissingLogging()
|
||||
|
||||
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren