[PC-BSD Commits] r6093 - pcbsd/trunk/SoundError

svn at pcbsd.org svn at pcbsd.org
Fri Jan 29 08:53:30 PST 2010


Author: kris
Date: 2010-01-29 08:53:30 -0800 (Fri, 29 Jan 2010)
New Revision: 6093

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

Fixed i18n for sound error dialog



Modified: pcbsd/trunk/SoundError/main.cpp
===================================================================
--- pcbsd/trunk/SoundError/main.cpp	2010-01-29 16:50:57 UTC (rev 6092)
+++ pcbsd/trunk/SoundError/main.cpp	2010-01-29 16:53:30 UTC (rev 6093)
@@ -1,6 +1,8 @@
 #include <kapplication.h>
 #include <kaboutdata.h>
 #include <kcmdlineargs.h>
+#include <QDebug>
+#include <QFile>
 #include <qtranslator.h>
 #include <qlocale.h>
 #include "snddialog.h"
@@ -28,13 +30,15 @@
 
 
     KApplication a;
-
-    QString locale = KGlobal::locale()->language();
     QTranslator translator;
-    translator.load(QString("SoundError_") + 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/SoundError_" + langCode + ".qm" ) )
+      langCode.truncate(langCode.indexOf("_"));
+    translator.load( QString("SoundError_") + langCode, "/usr/local/kde4/share/apps/pcbsd/i18n/" );
+    a.installTranslator( &translator );
+    qDebug() << "Locale:" << langCode;
 
-
     sndDialog w;
     w.programInit();
     a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );



More information about the Commits mailing list