#include "QtLauncher.hxx"
#include "QtLauncher_private.hxx"
+#include <locale.h>
+
// Qt
#include <QProgressDialog>
#include <QCoreApplication>
void initApp(int& argc, char** argv)
{
- sglog().setLogLevels( SG_ALL, SG_INFO );
- initQtResources(); // can't be called from a namespace
-
static bool qtInitDone = false;
static int s_argc;
if (!qtInitDone) {
qtInitDone = true;
+
+ sglog().setLogLevels( SG_ALL, SG_INFO );
+ initQtResources(); // can't be called from a namespace
+
s_argc = argc; // QApplication only stores a reference to argc,
// and may crash if it is freed
// http://doc.qt.io/qt-5/qguiapplication.html#QGuiApplication
app->setApplicationName("FlightGear");
app->setOrganizationDomain("flightgear.org");
+ // reset numeric / collation locales as described at:
+ // http://doc.qt.io/qt-5/qcoreapplication.html#details
+ ::setlocale(LC_NUMERIC, "C");
+ ::setlocale(LC_COLLATE, "C");
+
// avoid double Apple menu and other weirdness if both Qt and OSG
// try to initialise various Cocoa structures.
flightgear::WindowBuilder::setPoseAsStandaloneApp(false);
#include <stdio.h>
#include <cstring>
#include <iostream>
+#include <locale.h>
#include <simgear/compiler.h>
#include <simgear/structure/exception.hxx>
initFPE(flightgear::Options::checkForArg(argc, argv, "enable-fpe"));
+ // pick up all user locale settings, but force C locale for numerical/sorting
+ // conversions because we have lots of code which assumes standard
+ // formatting
+ setlocale(LC_ALL, "");
+ setlocale(LC_NUMERIC, "C");
+ setlocale(LC_COLLATE, "C");
+
bool fgviewer = flightgear::Options::checkForArg(argc, argv, "fgviewer");
try {
// http://code.google.com/p/flightgear-bugs/issues/detail?id=1231