-rw-r--r-- | library/qpeapplication.cpp | 68 |
1 files changed, 33 insertions, 35 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 0b6d56d..1117240 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -158,3 +158,2 @@ public: - QStringList langs; QString appName; @@ -760,2 +759,25 @@ void QPEApplication::processQCopFile() +#ifndef QT_NO_TRANSLATION +static void qtopia_loadTranslations( const QStringList& qms ) +{ + QStringList langs = Global::languageList(); + + for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { + QString lang = *it; + + QTranslator * trans; + QString tfn; + + for (QStringList::ConstIterator qmit = qms.begin(); qmit!=qms.end(); ++qmit) { + trans = new QTranslator(qApp); + tfn = QPEApplication::qpeDir() + "i18n/" + lang + "/" + *qmit + ".qm"; + if ( trans->load( tfn )) + qApp->installTranslator( trans ); + else + delete trans; + } + } +} +#endif + /*! @@ -847,3 +869,3 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t ) #else - initApp( argc, argv ); + initApp( argc, argv ); #endif @@ -854,21 +876,8 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t ) #ifndef QT_NO_TRANSLATION + QStringList qms; + qms << "libqpe"; + qms << "libopie"; + qms << d->appName; - d->langs = Global::languageList(); - for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) { - QString lang = *it; - - installTranslation( lang + "/libopie.qm"); - installTranslation( lang + "/libqpe.qm" ); - installTranslation( lang + "/" + d->appName + ".qm" ); - - - //###language/font hack; should look it up somewhere -#ifdef QWS - - if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { - QFont fn = FontManager::unicodeFont( FontManager::Proportional ); - setFont( fn ); - } -#endif - } + qtopia_loadTranslations(qms); #endif @@ -905,2 +914,6 @@ void QPEApplication::initApp( int argc, char **argv ) +#ifndef QT_NO_TRANSLATION + qtopia_loadTranslations( QStringList()<<channel ); +#endif + #if QT_VERSION > 235 @@ -936,6 +949,2 @@ void QPEApplication::initApp( int argc, char **argv ) setArgs(argc, argv); - - /* install translation here */ - for ( QStringList::ConstIterator it = d->langs.begin(); it != d->langs.end(); ++it ) - installTranslation( (*it) + "/" + d->appName + ".qm" ); } @@ -2181,13 +2190,2 @@ void QPEApplication::tryQuit() -/*! - \internal -*/ -void QPEApplication::installTranslation( const QString& baseName ) { - QTranslator* trans = new QTranslator(this); - QString tfn = qpeDir() + "/i18n/"+baseName; - if ( trans->load( tfn ) ) - installTranslator( trans ); - else - delete trans; -} |