[PC-BSD Commits] r4773 - pcbsd/trunk/XGUISource

svn at pcbsd.org svn at pcbsd.org
Mon Oct 26 09:27:26 PST 2009


Author: kris
Date: 2009-10-26 10:27:26 -0700 (Mon, 26 Oct 2009)
New Revision: 4773

Modified:
   pcbsd/trunk/XGUISource/XGUI.pro
   pcbsd/trunk/XGUISource/main.cpp
Log:

Updated XGUI to create / load i18n properly



Modified: pcbsd/trunk/XGUISource/XGUI.pro
===================================================================
--- pcbsd/trunk/XGUISource/XGUI.pro	2009-10-26 17:23:51 UTC (rev 4772)
+++ pcbsd/trunk/XGUISource/XGUI.pro	2009-10-26 17:27:26 UTC (rev 4773)
@@ -103,6 +103,8 @@
 temdriver.files = resources/templates/driver/*
 nvdetect.path = /usr/PCBSD/xorg-gui/nvidia-detect
 nvdetect.files = resources/nvidia-detect/*
+dotrans.path=/usr/local/kde4/share/apps/pcbsd/i18n/
+dotrans.extra=cd i18n && lrelease-qt4 *.ts && cp *.qm /usr/local/kde4/share/apps/pcbsd/i18n/
 
-INSTALLS += bin scripts conf fluxbox carddetect settings temscripts temheader temdriver nvdetect
+INSTALLS += bin scripts conf fluxbox carddetect settings temscripts temheader temdriver nvdetect dotrans
 

Modified: pcbsd/trunk/XGUISource/main.cpp
===================================================================
--- pcbsd/trunk/XGUISource/main.cpp	2009-10-26 17:23:51 UTC (rev 4772)
+++ pcbsd/trunk/XGUISource/main.cpp	2009-10-26 17:27:26 UTC (rev 4773)
@@ -35,14 +35,18 @@
 
     KApplication a;
 
-    QLocale mylocale;
-    QString nlang = QLocale::languageToString(mylocale.language());
+    QString locale = KGlobal::locale()->language();
+    QTranslator translator;
+    translator.load(QString("XGUISource_") + locale, "/usr/local/kde4/share/apps/pcbsd/i18n/");
+    a.installTranslator(&translator);
+
+
     // Check the language we are running in, and set the correct font
-    if (  nlang == "zh_CN" ||  nlang == "zh_TW" )
+    if (  locale == "zh_CN" ||  locale == "zh_TW" )
     {
       QFont f( "mingunittf", 10);
       a.setFont( f);
-    } else if ( nlang == "ja" ) {
+    } else if ( locale == "ja" ) {
       QFont f( "vlgothic", 10);
       a.setFont( f);
     } else {
@@ -60,10 +64,6 @@
 	if ( flag == "-test" )
 	{
 
-        QTranslator translator( 0 );
-        translator.load( QString("XGUISource_") + QLocale::languageToString(mylocale.language()), "/PCBSD/LANGS/" );
-        a.installTranslator( &translator );
-
         XGUI w;
 	dialogConfirm d;
         QDesktopWidget *desk = a.desktop();
@@ -80,10 +80,6 @@
         }
     } 
 
-    QTranslator translator( 0 );
-    translator.load( QString("XGUISource_") + QLocale::languageToString(mylocale.language()), "/PCBSD/LANGS/" );
-    a.installTranslator( &translator );
-
     XGUI w;
 
     QDesktopWidget *desk = a.desktop();



More information about the Commits mailing list