From f28f5b4a08f39bac697ab70ca1d9932167f979a9 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Sun, 8 Aug 2004 22:37:39 +0000 Subject: [PATCH] translate properly qt built-in text git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8875 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/ChangeLog | 7 +++++++ src/frontends/qt2/Makefile.am | 2 +- src/frontends/qt2/lyx_gui.C | 23 ++++++++++++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 04012ed639..d15b01096c 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,10 @@ +2004-08-08 Jean-Marc Lasgouttes + + * Makefile.am (AM_CXXFLAGS): do not disable QTranslator code + + * lyx_gui.C (parse_init): install a translator for Qt native + strings. + 2004-08-07 Jean-Marc Lasgouttes * QBibtexDialog.C (browsePressed): use ControlBibtex::browseBst diff --git a/src/frontends/qt2/Makefile.am b/src/frontends/qt2/Makefile.am index 22dcba7245..4c6c570bee 100644 --- a/src/frontends/qt2/Makefile.am +++ b/src/frontends/qt2/Makefile.am @@ -14,7 +14,7 @@ noinst_LTLIBRARIES = libqt2.la libqt2_la_LDFLAGS = $(QT_LDFLAGS) libqt2_la_LIBADD = $(QT_LIB) ui/*.lo moc/*.lo ui/moc/*.lo -AM_CXXFLAGS = -DQT_CLEAN_NAMESPACE -DQT_GENUINE_STR -DQT_NO_TRANSLATION +AM_CXXFLAGS = -DQT_CLEAN_NAMESPACE -DQT_GENUINE_STR libqt2_la_SOURCES = \ QDialogView.C \ diff --git a/src/frontends/qt2/lyx_gui.C b/src/frontends/qt2/lyx_gui.C index ecc714b1d2..fded5f8970 100644 --- a/src/frontends/qt2/lyx_gui.C +++ b/src/frontends/qt2/lyx_gui.C @@ -29,6 +29,7 @@ #include "support/lstrings.h" #include "support/os.h" +#include "debug.h" // Dear Lord, deliver us from Evil, aka the Qt headers // Qt defines a macro 'signals' that clashes with a boost namespace. @@ -50,6 +51,8 @@ #include #include +#include +#include using lyx::support::ltrim; @@ -152,7 +155,25 @@ bool use_gui = true; void parse_init(int & argc, char * argv[]) { - static LQApplication a(argc, argv); + static LQApplication app(argc, argv); + +#if QT_VERSION >= 0x030200 + // install translation file for Qt built-in dialogs + // These are only installed since Qt 3.2.x + static QTranslator qt_trans(0); + if (qt_trans.load(QString("qt_") + QTextCodec::locale(), + qInstallPathTranslations())) { + app.installTranslator(&qt_trans); + // even if the language calls for RtL, don't do that + app.setReverseLayout(false); + lyxerr[Debug::GUI] + << "Successfully installed Qt translations for locale " + << QTextCodec::locale() << std::endl; + } else + lyxerr[Debug::GUI] + << "Could not find Qt translations for locale " + << QTextCodec::locale() << std::endl; +#endif using namespace lyx::graphics;