fix:a regression .ctrl+c on article right context menu ,translation lost .

This commit is contained in:
xiaoyifang 2022-03-31 09:55:43 +08:00
parent e85c719577
commit 4648d95b94
4 changed files with 12 additions and 7 deletions

View file

@ -2285,13 +2285,17 @@ QString getProgramDataDir() throw()
#endif #endif
} }
QString getLocDir() throw() QString getEmbedLocDir() throw()
{ {
return ":/locale"; return ":/locale";
// if ( QDir( getProgramDataDir() ).cd( "locale" ) ) }
// return getProgramDataDir() + "/locale";
// else QString getLocDir() throw()
// return QCoreApplication::applicationDirPath() + "/locale"; {
if ( QDir( getProgramDataDir() ).cd( "locale" ) )
return getProgramDataDir() + "/locale";
else
return QCoreApplication::applicationDirPath() + "/locale";
} }
QString getHelpDir() throw() QString getHelpDir() throw()

View file

@ -801,6 +801,7 @@ QString getUserQtCssFileName() ;
QString getProgramDataDir() throw(); QString getProgramDataDir() throw();
/// Returns the directory storing program localizized files (.qm). /// Returns the directory storing program localizized files (.qm).
QString getEmbedLocDir() throw();
QString getLocDir() throw(); QString getLocDir() throw();
/// Returns the directory storing program help files (.qch). /// Returns the directory storing program help files (.qch).

View file

@ -396,7 +396,7 @@ int main( int argc, char ** argv )
app.installTranslator( &qtTranslator ); app.installTranslator( &qtTranslator );
} }
translator.load( Config::getLocDir() + "/" + localeName ); translator.load( Config::getEmbedLocDir() + "/" + localeName );
app.installTranslator( &translator ); app.installTranslator( &translator );
QTranslator webengineTs; QTranslator webengineTs;

View file

@ -63,7 +63,7 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
// See which other translations do we have // See which other translations do we have
QStringList availLocs = QDir( Config::getLocDir() ).entryList( QStringList( "*.qm" ), QStringList availLocs = QDir( Config::getEmbedLocDir() ).entryList( QStringList( "*.qm" ),
QDir::Files ); QDir::Files );
// We need to sort by language name -- otherwise list looks really weird // We need to sort by language name -- otherwise list looks really weird