[PC-BSD Commits] r6090 - pcbsd/trunk/pcbsdusermanager

svn at pcbsd.org svn at pcbsd.org
Fri Jan 29 08:37:22 PST 2010


Author: kris
Date: 2010-01-29 08:37:22 -0800 (Fri, 29 Jan 2010)
New Revision: 6090

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

Fixed i18n for usermanager



Modified: pcbsd/trunk/pcbsdusermanager/main.cpp
===================================================================
--- pcbsd/trunk/pcbsdusermanager/main.cpp	2010-01-29 16:33:44 UTC (rev 6089)
+++ pcbsd/trunk/pcbsdusermanager/main.cpp	2010-01-29 16:37:22 UTC (rev 6090)
@@ -3,6 +3,7 @@
 #include <kcmdlineargs.h>
 #include <qtranslator.h>
 #include <qlocale.h>
+#include <QDebug>
 #include "pcbsdusermanager.h"
 
 static const char description[] = I18N_NOOP("PC-BSD User Manager");
@@ -27,12 +28,15 @@
 
     KApplication a;
 
-    QString locale = KGlobal::locale()->language();
     QTranslator translator;
-    translator.load(QString("pcbsdusermanager_") + 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/pcbsdusermanager_" + langCode + ".qm" ) )
+      langCode.truncate(langCode.indexOf("_"));
+    translator.load( QString("pcbsdusermanager_") + langCode, "/usr/local/kde4/share/apps/pcbsd/i18n/" );
+    a.installTranslator( &translator );
+    qDebug() << "Locale:" << langCode;
 
-
     PCBSDUserManager w; 
 	
     w.show();



More information about the Commits mailing list