[PC-BSD Commits] r6089 - pcbsd/trunk/lifePreserver

svn at pcbsd.org svn at pcbsd.org
Fri Jan 29 08:33:44 PST 2010


Author: kris
Date: 2010-01-29 08:33:44 -0800 (Fri, 29 Jan 2010)
New Revision: 6089

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

Fixed lifePreserver loading i18n data



Modified: pcbsd/trunk/lifePreserver/main.cpp
===================================================================
--- pcbsd/trunk/lifePreserver/main.cpp	2010-01-29 16:27:41 UTC (rev 6088)
+++ pcbsd/trunk/lifePreserver/main.cpp	2010-01-29 16:33:44 UTC (rev 6089)
@@ -3,6 +3,7 @@
 #include <kcmdlineargs.h>
 #include <qtranslator.h>
 #include <qlocale.h>
+#include <QDebug>
 #include "preserver.h"
 #include "lifePreserverMain.h"
 
@@ -28,11 +29,14 @@
 
     KApplication a;
 
-
-    QTranslator translator( 0 );
+    QTranslator translator;
     QLocale mylocale;
-    translator.load( QString("lifePreserver_") + QLocale::languageToString(mylocale.language()), "/usr/PCBSD/lifePreserver/i18n/" );
+    QString langCode = mylocale.name();
+    if ( ! QFile::exists("/usr/PCBSD/lifePreserver/i18n/LifePreserver_" + langCode + ".qm" ) )
+      langCode.truncate(langCode.indexOf("_"));
+    translator.load( QString("LifePreserver_") + langCode, "/usr/PCBSD/lifePreserver/i18n/" );
     a.installTranslator( &translator );
+    qDebug() << "Locale:" << langCode;
 
     lifePreserver w; 
 	



More information about the Commits mailing list