[PC-BSD Commits] r16442 - pcbsd/current/src-qt4/warden-gui

svn at pcbsd.org svn at pcbsd.org
Tue Apr 17 08:55:28 PDT 2012


Author: kris
Date: 2012-04-17 15:55:28 +0000 (Tue, 17 Apr 2012)
New Revision: 16442

Modified:
   pcbsd/current/src-qt4/warden-gui/main.cpp
Log:

Enable loading i18n files for Warden GUI



Modified: pcbsd/current/src-qt4/warden-gui/main.cpp
===================================================================
--- pcbsd/current/src-qt4/warden-gui/main.cpp	2012-04-17 15:27:24 UTC (rev 16441)
+++ pcbsd/current/src-qt4/warden-gui/main.cpp	2012-04-17 15:55:28 UTC (rev 16442)
@@ -1,11 +1,23 @@
-#include <qapplication.h>
+#include <QApplication>
+#include <QDebug>
+#include <QTranslator>
+#include <err.h>
 #include "dialogwarden.h"
-#include <err.h>
 
 int main( int argc, char ** argv )
 {
     QApplication a(argc, argv, TRUE);
 
+    QTranslator translator;
+    QLocale mylocale;
+    QString langCode = mylocale.name();
+    if ( ! QFile::exists( "/usr/local/share/warden/i18n/Warden_" + langCode + ".qm" ) )
+      langCode.truncate(langCode.indexOf("_"));
+    translator.load( QString("Warden_") + langCode, "/usr/local/share/warden/i18n/" );
+    a.installTranslator( &translator );
+    qDebug() << "Locale:" << langCode;
+
+
     dialogWarden *w = new dialogWarden();
     w->programInit();
     w->show();



More information about the Commits mailing list