[PC-BSD Commits] r6092 - pcbsd/trunk/SystemUpdaterTray

svn at pcbsd.org svn at pcbsd.org
Fri Jan 29 08:50:57 PST 2010


Author: kris
Date: 2010-01-29 08:50:57 -0800 (Fri, 29 Jan 2010)
New Revision: 6092

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

Fixed i18n for systemUpdate Notifer



Modified: pcbsd/trunk/SystemUpdaterTray/main.cpp
===================================================================
--- pcbsd/trunk/SystemUpdaterTray/main.cpp	2010-01-29 16:48:38 UTC (rev 6091)
+++ pcbsd/trunk/SystemUpdaterTray/main.cpp	2010-01-29 16:50:57 UTC (rev 6092)
@@ -2,6 +2,8 @@
 #include <qtranslator.h>
 #include <qtextcodec.h>
 #include <qlocale.h>
+#include <QDebug>
+#include <QFile>
 #include <kuniqueapplication.h>
 #include <kaboutdata.h>
 #include <kcmdlineargs.h>
@@ -30,16 +32,19 @@
 
    KUniqueApplication a;
 
+   QTranslator translator;
+   QLocale mylocale;
+   QString langCode = mylocale.name();
+   if ( ! QFile::exists("/usr/local/kde4/share/apps/pcbsd/i18n/SystemUpdaterTray_" + langCode + ".qm" ) )
+     langCode.truncate(langCode.indexOf("_"));
+   translator.load( QString("SystemUpdaterTray_") + langCode, "/usr/local/kde4/share/apps/pcbsd/i18n/" );
+   a.installTranslator( &translator );
+   qDebug() << "Locale:" << langCode;
+
    UpdaterTray tray;
    //a.setMainWidget(tray.contextMenu());
    a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
 
-
-   QString locale = KGlobal::locale()->language();
-   QTranslator translator;
-   translator.load(QString("SystemUpdaterTray_") + locale, "/usr/local/kde4/share/apps/pcbsd/i18n/");
-   a.installTranslator(&translator);
-
    // Init our program
    tray.programInit();
    tray.show();



More information about the Commits mailing list