[PC-BSD Commits] r18431 - in pcbsd-projects/PCDM: . i18n

svn at pcbsd.org svn at pcbsd.org
Mon Aug 13 18:50:19 PDT 2012


Author: kenmoore
Date: 2012-08-14 01:50:19 +0000 (Tue, 14 Aug 2012)
New Revision: 18431

Modified:
   pcbsd-projects/PCDM/i18n/PCDM_af.ts
   pcbsd-projects/PCDM/i18n/PCDM_ar.ts
   pcbsd-projects/PCDM/i18n/PCDM_az.ts
   pcbsd-projects/PCDM/i18n/PCDM_bg.ts
   pcbsd-projects/PCDM/i18n/PCDM_bn.ts
   pcbsd-projects/PCDM/i18n/PCDM_bs.ts
   pcbsd-projects/PCDM/i18n/PCDM_ca.ts
   pcbsd-projects/PCDM/i18n/PCDM_cs.ts
   pcbsd-projects/PCDM/i18n/PCDM_cy.ts
   pcbsd-projects/PCDM/i18n/PCDM_da.ts
   pcbsd-projects/PCDM/i18n/PCDM_de.ts
   pcbsd-projects/PCDM/i18n/PCDM_el.ts
   pcbsd-projects/PCDM/i18n/PCDM_en_GB.ts
   pcbsd-projects/PCDM/i18n/PCDM_en_ZA.ts
   pcbsd-projects/PCDM/i18n/PCDM_es.ts
   pcbsd-projects/PCDM/i18n/PCDM_et.ts
   pcbsd-projects/PCDM/i18n/PCDM_eu.ts
   pcbsd-projects/PCDM/i18n/PCDM_fa.ts
   pcbsd-projects/PCDM/i18n/PCDM_fi.ts
   pcbsd-projects/PCDM/i18n/PCDM_fr.ts
   pcbsd-projects/PCDM/i18n/PCDM_fr_CA.ts
   pcbsd-projects/PCDM/i18n/PCDM_fur.ts
   pcbsd-projects/PCDM/i18n/PCDM_gl.ts
   pcbsd-projects/PCDM/i18n/PCDM_he.ts
   pcbsd-projects/PCDM/i18n/PCDM_hi.ts
   pcbsd-projects/PCDM/i18n/PCDM_hr.ts
   pcbsd-projects/PCDM/i18n/PCDM_hu.ts
   pcbsd-projects/PCDM/i18n/PCDM_id.ts
   pcbsd-projects/PCDM/i18n/PCDM_is.ts
   pcbsd-projects/PCDM/i18n/PCDM_it.ts
   pcbsd-projects/PCDM/i18n/PCDM_ja.ts
   pcbsd-projects/PCDM/i18n/PCDM_ka.ts
   pcbsd-projects/PCDM/i18n/PCDM_ko.ts
   pcbsd-projects/PCDM/i18n/PCDM_lt.ts
   pcbsd-projects/PCDM/i18n/PCDM_lv.ts
   pcbsd-projects/PCDM/i18n/PCDM_mk.ts
   pcbsd-projects/PCDM/i18n/PCDM_mn.ts
   pcbsd-projects/PCDM/i18n/PCDM_ms.ts
   pcbsd-projects/PCDM/i18n/PCDM_mt.ts
   pcbsd-projects/PCDM/i18n/PCDM_nb.ts
   pcbsd-projects/PCDM/i18n/PCDM_ne.ts
   pcbsd-projects/PCDM/i18n/PCDM_nl.ts
   pcbsd-projects/PCDM/i18n/PCDM_pa.ts
   pcbsd-projects/PCDM/i18n/PCDM_pl.ts
   pcbsd-projects/PCDM/i18n/PCDM_pt.ts
   pcbsd-projects/PCDM/i18n/PCDM_pt_BR.ts
   pcbsd-projects/PCDM/i18n/PCDM_ro.ts
   pcbsd-projects/PCDM/i18n/PCDM_ru.ts
   pcbsd-projects/PCDM/i18n/PCDM_sk.ts
   pcbsd-projects/PCDM/i18n/PCDM_sl.ts
   pcbsd-projects/PCDM/i18n/PCDM_sr.ts
   pcbsd-projects/PCDM/i18n/PCDM_sv.ts
   pcbsd-projects/PCDM/i18n/PCDM_sw.ts
   pcbsd-projects/PCDM/i18n/PCDM_ta.ts
   pcbsd-projects/PCDM/i18n/PCDM_tg.ts
   pcbsd-projects/PCDM/i18n/PCDM_th.ts
   pcbsd-projects/PCDM/i18n/PCDM_tr.ts
   pcbsd-projects/PCDM/i18n/PCDM_uk.ts
   pcbsd-projects/PCDM/i18n/PCDM_uz.ts
   pcbsd-projects/PCDM/i18n/PCDM_vi.ts
   pcbsd-projects/PCDM/i18n/PCDM_zh_CN.ts
   pcbsd-projects/PCDM/i18n/PCDM_zh_HK.ts
   pcbsd-projects/PCDM/i18n/PCDM_zh_TW.ts
   pcbsd-projects/PCDM/i18n/PCDM_zu.ts
   pcbsd-projects/PCDM/main.cpp
   pcbsd-projects/PCDM/pcdm-gui.cpp
   pcbsd-projects/PCDM/pcdm-gui.h
Log:
Setup a different system for performing the locale/language changei in PCDM. This method should be pretty much instant, but needs further testing to make sure it is working properly.



Modified: pcbsd-projects/PCDM/i18n/PCDM_af.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_ar.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_az.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_bg.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_bn.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_bs.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_ca.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_cs.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_cy.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_da.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_de.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_el.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_en_GB.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_en_ZA.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_es.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_et.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_eu.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_fa.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_fi.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_fr.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_fr_CA.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_fur.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_gl.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_he.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_hi.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_hr.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_hu.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_id.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_is.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_it.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_ja.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_ka.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_ko.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_lt.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_lv.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_mk.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_mn.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_ms.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_mt.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_nb.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_ne.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_nl.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_pa.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_pl.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_pt.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_pt_BR.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_ro.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_ru.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_sk.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_sl.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_sr.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_sv.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_sw.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_ta.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_tg.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_th.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_tr.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_uk.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_uz.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_vi.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_zh_CN.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_zh_HK.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_zh_TW.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/i18n/PCDM_zu.ts
===================================================================
(Binary files differ)

Modified: pcbsd-projects/PCDM/main.cpp
===================================================================
--- pcbsd-projects/PCDM/main.cpp	2012-08-13 20:48:48 UTC (rev 18430)
+++ pcbsd-projects/PCDM/main.cpp	2012-08-14 01:50:19 UTC (rev 18431)
@@ -52,7 +52,6 @@
       }
 
       // Show our splash screen, so the user doesn't freak that that it takes a few seconds to show up
-      //QPixmap* pixmap; //create an empty pixmap
       QSplashScreen splash;
       if(Theme::useSplashscreen()){
         splash.setPixmap( QPixmap(Theme::splashscreen()) ); //load the splashscreen file

Modified: pcbsd-projects/PCDM/pcdm-gui.cpp
===================================================================
--- pcbsd-projects/PCDM/pcdm-gui.cpp	2012-08-13 20:48:48 UTC (rev 18430)
+++ pcbsd-projects/PCDM/pcdm-gui.cpp	2012-08-14 01:50:19 UTC (rev 18431)
@@ -35,7 +35,10 @@
     style.append(bgstyle);
   }
   this->setStyleSheet(style);
-
+  //get the default translation directory
+  translationDir = QApplication::applicationDirPath() + "/i18n/";
+  //Fill the translator
+  m_translator = new QTranslator();
   //Create the Toolbar
   toolbar = new QToolBar();
   //Add the Toolbar to the window
@@ -290,6 +293,9 @@
 void PCDMgui::slotChangeLocale(){
   //Open the selector
   wLoc = new widgetLocale(this);
+  QLocale currLocale = this->locale();
+  qDebug() << "Current PCDM Locale:" << currLocale.name();
+  wLoc->setCurrentLocale(currLocale.name());
   wLoc->setWindowModality(Qt::ApplicationModal);
   wLoc->show();
   wLoc->raise();
@@ -302,6 +308,7 @@
   qDebug() << "Changing localization to" << langCode;
   
   // Now write out the lang code and close
+  /*
   QFile lfile( TMPLANGFILE );
   if ( lfile.open( QIODevice::WriteOnly ) ) {
     QTextStream stream( &lfile );
@@ -309,10 +316,39 @@
     lfile.close();
   }
   slotClosePCDM();
+  */
+  //Get the valid Locale code
+  QString translationFile;
+  if(!QFile::exists(translationDir+"PCDM_"+langCode+".qm")){
+    langCode = langCode.section("_",0,0);
+    if(!QFile::exists(translationDir+"PCDM_"+langCode+".qm")){
+      if(!QFile::exists(translationDir+"qt_"+langCode+".qm")){
+      	qDebug() << "Desired locale is not a valid translation:" << langCode;
+      	return;
+      }else{
+        translationFile = translationDir+"qt_"+langCode+".qm";	    
+      }
+    }else{
+      translationFile = translationDir+"PCDM_"+langCode+".qm";	    
+    }
+  }else{
+    translationFile = translationDir+"PCDM_"+langCode+".qm";
+  }
+  //Alternate method for changing Locale
+  QLocale locale(langCode);
+  this->setLocale(locale);
+  //this->setDefaultLocale(locale);
+  //Change the translator
+  qDebug() << "Remove the translator";
+  QCoreApplication::removeTranslator(m_translator);
+  qDebug() << "load the new translator";
+  if(m_translator->load(translationFile)){
+    QCoreApplication::installTranslator(m_translator);	  
+  }
+  //Re-draw the interface
+  //this->retranslateUi(this);
   
-  //Alternate method for changing Locale
-  //QLocale locale(langCode);
-  //this->setLocale(locale);
+  qDebug() << "Current Locale after change:"<<this->locale().name();
 }
 
 void PCDMgui::slotChangeKeyboardLayout(){

Modified: pcbsd-projects/PCDM/pcdm-gui.h
===================================================================
--- pcbsd-projects/PCDM/pcdm-gui.h	2012-08-13 20:48:48 UTC (rev 18430)
+++ pcbsd-projects/PCDM/pcdm-gui.h	2012-08-14 01:50:19 UTC (rev 18431)
@@ -58,6 +58,8 @@
     QProcess* vkbd;
     QStringList kModels, kLayouts;
 
+    QTranslator* m_translator;
+    QString translationDir;
     //Functions
     void createGUIfromTheme();
 



More information about the Commits mailing list