* GuiApplication.C (GuiApplication): make sure that the Qtranslator

holding the Qt translations is not deleted. Now keyboard shortcuts and
	Qt stock dialogs are properly translated.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16496 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2007-01-04 11:05:57 +00:00
parent 9479b1323f
commit 3db3cc44dd
2 changed files with 5 additions and 3 deletions

View File

@ -107,13 +107,12 @@ GuiApplication::GuiApplication(int & argc, char ** argv)
#endif #endif
// install translation file for Qt built-in dialogs // install translation file for Qt built-in dialogs
QTranslator qt_trans;
QString language_name = QString("qt_") + QLocale::system().name(); QString language_name = QString("qt_") + QLocale::system().name();
language_name.truncate(5); language_name.truncate(5);
if (qt_trans.load(language_name, if (qt_trans_.load(language_name,
QLibraryInfo::location(QLibraryInfo::TranslationsPath))) QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
{ {
qApp->installTranslator(&qt_trans); qApp->installTranslator(&qt_trans_);
// even if the language calls for RtL, don't do that // even if the language calls for RtL, don't do that
qApp->setLayoutDirection(Qt::LeftToRight); qApp->setLayoutDirection(Qt::LeftToRight);
lyxerr[Debug::GUI] lyxerr[Debug::GUI]

View File

@ -22,6 +22,7 @@
#include "frontends/Application.h" #include "frontends/Application.h"
#include <QApplication> #include <QApplication>
#include <QTranslator>
namespace lyx { namespace lyx {
@ -92,6 +93,8 @@ private:
/// ///
ColorCache color_cache_; ColorCache color_cache_;
/// ///
QTranslator qt_trans_;
///
std::map<int, boost::shared_ptr<socket_callback> > socket_callbacks_; std::map<int, boost::shared_ptr<socket_callback> > socket_callbacks_;
#ifdef Q_WS_X11 #ifdef Q_WS_X11