From: vsr Date: Thu, 24 Feb 2011 14:47:25 +0000 (+0000) Subject: Internationalization: fix problem of Qt resources loading when qt library is copied... X-Git-Tag: V6_3_0a1~50 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bb2c17768a944a22f61b9e22f5d90d750e8f32c9;p=modules%2Fgui.git Internationalization: fix problem of Qt resources loading when qt library is copied to another place (requires QTDIR environment variable to be specified). --- diff --git a/src/Qtx/QtxResourceMgr.cxx b/src/Qtx/QtxResourceMgr.cxx index 1dbef97ae..39f93cb05 100644 --- a/src/Qtx/QtxResourceMgr.cxx +++ b/src/Qtx/QtxResourceMgr.cxx @@ -2594,8 +2594,14 @@ void QtxResourceMgr::loadLanguage( const QString& pref, const QString& l ) if ( pref.isEmpty() && lang != "en" ) { // load Qt resources QString qt_translations = QLibraryInfo::location( QLibraryInfo::TranslationsPath ); + QString qt_dir_trpath; + if ( ::getenv( "QTDIR" ) ) + qt_dir_trpath = QString( ::getenv( "QTDIR" ) ); + if ( !qt_dir_trpath.isEmpty() ) + qt_dir_trpath = QDir( qt_dir_trpath ).absoluteFilePath( "translations" ); + QTranslator* trans = new QtxTranslator( 0 ); - if ( trans->load( QString("qt_%1").arg( lang ), qt_translations ) ) + if ( trans->load( QString("qt_%1").arg( lang ), qt_translations ) || trans->load( QString("qt_%1").arg( lang ), qt_dir_trpath ) ) QApplication::instance()->installTranslator( trans ); }