From bb2c17768a944a22f61b9e22f5d90d750e8f32c9 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 24 Feb 2011 14:47:25 +0000 Subject: [PATCH] Internationalization: fix problem of Qt resources loading when qt library is copied to another place (requires QTDIR environment variable to be specified). --- src/Qtx/QtxResourceMgr.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 ); } -- 2.39.2