[Marble-commits] KDE/kdeedu/marble/src [POSSIBLY UNSAFE]
Bastian Holst
bastianholst at gmx.de
Sun Jul 12 22:48:00 CEST 2009
SVN commit 995490 by bholst:
Marble: Using QLocale instead of system variables makes language
detection more portable.
M +4 -12 lib/MarbleLocale.cpp [POSSIBLY UNSAFE: system]
M +1 -1 lib/TinyWebBrowser.cpp
M +1 -1 plugins/render/wikipedia/WikipediaModel.cpp
--- trunk/KDE/kdeedu/marble/src/lib/MarbleLocale.cpp #995489:995490
@@ -11,7 +11,10 @@
#include "MarbleLocale.h"
#include "MarbleLocale_p.h"
+// Qt
+#include <QtCore/QLocale>
+
namespace Marble {
MarbleLocalePrivate::MarbleLocalePrivate()
@@ -63,20 +66,9 @@
}
QString MarbleLocale::languageCode() {
- const QString lang = qgetenv( "LANG" );
+ const QString lang = QLocale::system().name();
QString code;
- if ( lang.isEmpty() || lang == "POSIX" || lang == "C" )
- code = "en";
- else
- code = lang;
- return code;
-}
-
-QString MarbleLocale::simpleLanguageCode() {
- const QString lang = languageCode();
- QString code;
-
int index = lang.indexOf ( '_' );
if ( index != -1 ) {
code = lang.left ( index );
--- trunk/KDE/kdeedu/marble/src/lib/TinyWebBrowser.cpp #995489:995490
@@ -33,7 +33,7 @@
static QString guessWikipediaDomain()
{
- const QString code = MarbleLocale::simpleLanguageCode();
+ const QString code = MarbleLocale::languageCode();
return QString ( "http://%1.wikipedia.org/" ).arg ( code );
}
--- trunk/KDE/kdeedu/marble/src/plugins/render/wikipedia/WikipediaModel.cpp #995489:995490
@@ -40,7 +40,7 @@
{
m_wikipediaIcon.addFile( MarbleDirs::path( "svg/wikipedia.svg" ) );
- m_languageCode = MarbleLocale::simpleLanguageCode();
+ m_languageCode = MarbleLocale::languageCode();
}
WikipediaModel::~WikipediaModel() {
More information about the Marble-commits
mailing list