[PC-BSD Commits] r6088 - pcbsd/trunk/SoftwareManager

svn at pcbsd.org svn at pcbsd.org
Fri Jan 29 08:27:41 PST 2010


Author: kris
Date: 2010-01-29 08:27:41 -0800 (Fri, 29 Jan 2010)
New Revision: 6088

Modified:
   pcbsd/trunk/SoftwareManager/main.cpp
Log:

Fixed locale loading in SoftwareManager



Modified: pcbsd/trunk/SoftwareManager/main.cpp
===================================================================
--- pcbsd/trunk/SoftwareManager/main.cpp	2010-01-29 16:16:43 UTC (rev 6087)
+++ pcbsd/trunk/SoftwareManager/main.cpp	2010-01-29 16:27:41 UTC (rev 6088)
@@ -27,11 +27,14 @@
 
     KApplication a;
 
-
-    QString locale = KGlobal::locale()->language();
     QTranslator translator;
-    translator.load(QString("SoftwareManager_") + locale, "/usr/local/kde4/share/apps/pcbsd/i18n/");
-    a.installTranslator(&translator);
+    QLocale mylocale;
+    QString langCode = mylocale.name();
+    if ( ! QFile::exists("/usr/local/kde4/share/apps/pcbsd/i18n/SoftwareManager_" + langCode + ".qm" ) )
+      langCode.truncate(langCode.indexOf("_"));
+    translator.load( QString("SoftwareManager_") + langCode, "/usr/local/kde4/share/apps/pcbsd/i18n/" );
+    a.installTranslator( &translator );
+    qDebug() << "Locale:" << langCode;
 
     PBM w; 
 	



More information about the Commits mailing list