From kde-commits Sun Jan 09 10:13:01 2011 From: =?utf-8?q?Dennis=20Nienh=C3=BCser?= Date: Sun, 09 Jan 2011 10:13:01 +0000 To: kde-commits Subject: KDE/kdeedu/marble/src Message-Id: <20110109101301.AA56BAC8B0 () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=129456801915000 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 #include #include +#include #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);