author | zecke <zecke> | 2004-10-15 22:27:30 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-10-15 22:27:30 (UTC) |
commit | bc127247d5c74f05b58610cbc94ebc8682a16c7f (patch) (side-by-side diff) | |
tree | 433984506aa9b22f916c0ae966956fc53b29197c /library | |
parent | db5e39dbf2e81b3e4e2a7e13fa1a51c34a86e319 (diff) | |
download | opie-bc127247d5c74f05b58610cbc94ebc8682a16c7f.zip opie-bc127247d5c74f05b58610cbc94ebc8682a16c7f.tar.gz opie-bc127247d5c74f05b58610cbc94ebc8682a16c7f.tar.bz2 |
Remove QPEApplication::installTranslator and use qtopia_installTranslator
patch adopted from Qtopia1.7
-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; -} |