[PC-BSD Commits] r6094 - pcbsd/trunk/CrashHandler

svn at pcbsd.org svn at pcbsd.org
Fri Jan 29 08:56:35 PST 2010


Author: kris
Date: 2010-01-29 08:56:35 -0800 (Fri, 29 Jan 2010)
New Revision: 6094

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

Fixed i18n for crashHandler



Modified: pcbsd/trunk/CrashHandler/main.cpp
===================================================================
--- pcbsd/trunk/CrashHandler/main.cpp	2010-01-29 16:53:30 UTC (rev 6093)
+++ pcbsd/trunk/CrashHandler/main.cpp	2010-01-29 16:56:35 UTC (rev 6094)
@@ -1,30 +1,23 @@
 #include <qapplication.h>
 #include <qtranslator.h>
 #include <qtextcodec.h>
+#include <QLocale>
+#include <QDebug>
+#include <QFile>
 #include "crashhandler.h"
 
 int main( int argc, char ** argv )
 {
     QApplication a( argc, argv );
-    
-    QString locale = QLocale::system().name();
-    QTranslator translator;
-    translator.load(QString("CrashHandler_") + locale, "/usr/local/kde4/share/apps/pcbsd/i18n/");
-    a.installTranslator(&translator);
 
-    if ( locale != "vi" && locale != "zh_CN" && locale != "zh_TW" && locale != "ja" && locale != "ko" )
-    {
-      QFont f( "DejaVu Sans", 10);
-      f.setStyleHint( QFont::SansSerif );
-      a.setFont( f );
-    } else {
-
-      QFont f( "Serif", 10);
-      f.setStyleHint( QFont::Serif );
-      a.setFont( f );
-    }
-
-
+    QTranslator translator;
+    QLocale mylocale;
+    QString langCode = mylocale.name();
+    if ( ! QFile::exists("/usr/local/kde4/share/apps/pcbsd/i18n/CrashHandler_" + langCode + ".qm" ) )
+      langCode.truncate(langCode.indexOf("_"));
+    translator.load( QString("CrashHandler_") + langCode, "/usr/local/kde4/share/apps/pcbsd/i18n/" );
+    a.installTranslator( &translator );
+    qDebug() << "Locale:" << langCode;
     
     CrashHandler w;
     if (a.argc() != 4) {



More information about the Commits mailing list