[PC-BSD Commits] r5047 - pcbsd/trunk/SysInstaller

svn at pcbsd.org svn at pcbsd.org
Tue Nov 17 11:47:29 PST 2009


Author: kris
Date: 2009-11-17 11:47:29 -0800 (Tue, 17 Nov 2009)
New Revision: 5047

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

Added support to install Translator files when we load SysInstaller



Modified: pcbsd/trunk/SysInstaller/main.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/main.cpp	2009-11-17 19:42:47 UTC (rev 5046)
+++ pcbsd/trunk/SysInstaller/main.cpp	2009-11-17 19:47:29 UTC (rev 5047)
@@ -1,4 +1,6 @@
 #include <QtGui/QApplication>
+#include <QTranslator>
+#include <QLocale>
 
 #include "sysinstaller.h"
 
@@ -6,6 +8,25 @@
 {
     QApplication a(argc, argv);
 
+    // Check what directory our app is in
+    QString appDir;
+    if ( QFile::exists("/usr/local/pcbsd/bin/SysInstaller") )
+    {
+      appDir = "/usr/local/pcbsd";
+    } else {
+      appDir = QCoreApplication::applicationDirPath();
+    }
+
+
+    QTranslator translator( 0 );
+    QLocale mylocale;
+    QString langCode = mylocale.name();
+    if ( QFile::exists(appDir + "/i18n/SysInstaller_" + langCode + ".qm" ) )
+      langCode.truncate(langCode.indexOf("_"));
+    translator.load( QString("SysInstaller_") + langCode, appDir + "/i18n/" );
+    qDebug() << "Locale:" << langCode;
+
+
     SysInstaller w;
     w.show();
 



More information about the Commits mailing list