KDE/kdelibs/kdecore/localization [POSSIBLY UNSAFE]

Jaroslaw Staniek js at iidea.pl
Thu Mar 6 11:11:56 CET 2008


SVN commit 782853 by staniek:

Windows: fall back to system locale for l10n. 

Now it is enough to remove Country and Language from [Locale] group in kdeglobals, 
to be in sync with Windows registry settings.

Thanks to Frank for requesting this.

CCMAIL:kde-windows at kde.org
CCMAIL:frank at kdab.net




 M  +7 -1      klocale.cpp   [POSSIBLY UNSAFE: system]


--- trunk/KDE/kdelibs/kdecore/localization/klocale.cpp #782852:782853
@@ -43,6 +43,7 @@
 #include <QtGui/QPrinter>
 #include <QtCore/QFileInfo>
 #include <QtCore/QRegExp>
+#include <QtCore/QLocale>
 
 #include "kcatalog_p.h"
 #include "kglobal.h"
@@ -304,6 +305,7 @@
   list += cg.readEntry("Language", QString()).split(':');
 
   // Collect languages read from environment variables by gettext(3).
+  QStringList rawList;
   if (useEnv) {
     // Collect by same order of priority as for gettext(3).
 
@@ -317,7 +319,11 @@
     rawList += QFile::decodeName(getenv("LC_ALL"));
     rawList += QFile::decodeName(getenv("LC_MESSAGES"));
     rawList += QFile::decodeName(getenv("LANG"));
-
+  }
+#ifdef Q_WS_WIN // how about Mac?
+  rawList += QLocale::system().name(); // fall back to the system language
+#endif
+  if (useEnv) { // Collect languages  - continued...
     // Process the raw list to create possible combinations.
     foreach (const QString &ln, rawList) {
       QString lang, ctry, modf, cset;



More information about the Kde-windows mailing list