1
0
Fork 0

Launcher: set package locale based on user language

This should in theory enable localised strings in catalogs, but need
to validate the full workflow here.
This commit is contained in:
James Turner 2020-03-17 11:46:26 +00:00
parent ffbbe54cbc
commit a22d7943a4

View file

@ -52,6 +52,7 @@
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>
#include <simgear/structure/subsystem_mgr.hxx> #include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/package/Root.hxx>
#include <simgear/package/Catalog.hxx> #include <simgear/package/Catalog.hxx>
#include <simgear/package/Package.hxx> #include <simgear/package/Package.hxx>
#include <simgear/package/Install.hxx> #include <simgear/package/Install.hxx>
@ -452,6 +453,15 @@ bool runLauncherDialog()
fgInitPackageRoot(); fgInitPackageRoot();
// setup package language
auto lang = options->valueForOption("language");
if (!lang.empty()) {
globals->packageRoot()->setLocale(lang);
} else {
const auto langName = QLocale::languageToString(QLocale{}.language());
globals->packageRoot()->setLocale(langName.toStdString());
}
// startup the HTTP system now since packages needs it // startup the HTTP system now since packages needs it
FGHTTPClient* http = globals->add_new_subsystem<FGHTTPClient>(); FGHTTPClient* http = globals->add_new_subsystem<FGHTTPClient>();