[Marble-commits] branches/KDE/4.6/kdeedu/marble/src

Dennis Nienhüser earthwings at gentoo.org
Sun Jan 9 11:18:21 CET 2011


SVN commit 1213143 by nienhueser:

Work around http://bugreports.qt.nokia.com/browse/QTBUG-1313: When using mixed locale settings, LC_NUMERIC is used by Qt to determine QLocale::system().lang(), but LC_MESSAGES would be correct. #ifdefed for Maemo since the workaround is not portable. Fixes GUI messages coming up in the wrong language when using different language and regional settings on the N900.
Backport of commit 1213140.

 M  +16 -0     qtmain.cpp  


--- branches/KDE/4.6/kdeedu/marble/src/qtmain.cpp #1213142:1213143
@@ -15,6 +15,7 @@
 #include <QtCore/QLocale>
 #include <QtCore/QSettings>
 #include <QtCore/QTranslator>
+#include <QtCore/QProcessEnvironment>
 
 #include "QtMainWindow.h"
 
@@ -49,7 +50,22 @@
     QApplication app(argc, argv);
     // Widget translation
 
+#ifdef Q_WS_MAEMO_5
+    // Work around http://bugreports.qt.nokia.com/browse/QTBUG-1313
+    QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
+    QString lang( "C" );
+    QStringList const locales = QStringList() << "LC_ALL" << "LC_MESSAGES" << "LANG" << "LANGUAGE";
+    foreach( const QString &locale, locales ) {
+        if ( env.contains( locale ) && !env.value( locale ).isEmpty() ) {
+            lang = env.value( locale, "C" );
+            break;
+        }
+    }
+
+    lang = lang.section( '_', 0, 0 );
+#else
     QString      lang = QLocale::system().name().section('_', 0, 0);
+#endif
     QTranslator  translator;
     translator.load( "marble-" + lang, MarbleDirs::path(QString("lang") ) );
     app.installTranslator(&translator);


More information about the Marble-commits mailing list