[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/marble/src
From:       Dennis Nienhüser <earthwings () gentoo ! org>
Date:       2011-01-09 10:13:01
Message-ID: 20110109101301.AA56BAC8B0 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1213140 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.

 M  +16 -0     qtmain.cpp  


--- trunk/KDE/kdeedu/marble/src/qtmain.cpp #1213139:1213140
@@ -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);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic