qt_dir_trpath = QDir( qt_dir_trpath ).absoluteFilePath( "translations" );
QTranslator* trans = new QtxTranslator( 0 );
- if ( trans->load( QString("qt_%1").arg( lang ), qt_translations ) || trans->load( QString("qt_%1").arg( lang ), qt_dir_trpath ) )
- QApplication::instance()->installTranslator( trans );
+ if ( trans->load( QString("qt_%1").arg( lang ), qt_translations ) || trans->load( QString("qt_%1").arg( lang ), qt_dir_trpath ) ) {
+ if ( QApplication::instance() ) QApplication::instance()->installTranslator( trans );
+ }
}
for ( QStringList::ConstIterator iter = prefixList.begin(); iter != prefixList.end(); ++iter )
{
if ( !myTranslator[prefix].contains( trans ) )
myTranslator[prefix].append( trans );
- QApplication::instance()->installTranslator( trans );
+ if ( QApplication::instance() ) QApplication::instance()->installTranslator( trans );
}
}
}
{
if ( !myTranslator[prefix].contains( trans ) )
myTranslator[prefix].append( trans );
- QApplication::instance()->installTranslator( trans );
+ if ( QApplication::instance() ) QApplication::instance()->installTranslator( trans );
}
}
}
for ( TransList::Iterator it = myTranslator[prefix].begin(); it != myTranslator[prefix].end(); ++it )
{
- QApplication::instance()->removeTranslator( *it );
+ if ( QApplication::instance() ) QApplication::instance()->removeTranslator( *it );
delete *it;
}
for ( TransList::Iterator it = myTranslator[prefix].begin(); it != myTranslator[prefix].end(); ++it )
{
- QApplication::instance()->removeTranslator( *it );
- QApplication::instance()->installTranslator( *it );
+ if ( QApplication::instance() ) {
+ QApplication::instance()->removeTranslator( *it );
+ QApplication::instance()->installTranslator( *it );
+ }
}
}