]> git.lyx.org Git - features.git/commitdiff
translate properly qt built-in text
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 8 Aug 2004 22:37:39 +0000 (22:37 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 8 Aug 2004 22:37:39 +0000 (22:37 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8875 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/ChangeLog
src/frontends/qt2/Makefile.am
src/frontends/qt2/lyx_gui.C

index 04012ed63993e413e528d0985315c5734663f3c9..d15b01096c5f04c4a9e9f033c6ff43baea419dcd 100644 (file)
@@ -1,3 +1,10 @@
+2004-08-08  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * 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  <lasgouttes@lyx.org>
 
        * QBibtexDialog.C (browsePressed): use ControlBibtex::browseBst
index 22dcba72455d54631a7b41bb4a31ccdef34ed7e0..4c6c570bee1152f2c90c70d6797753a31c4d7df1 100644 (file)
@@ -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 \
index ecc714b1d2eaee47daa4073177d16c561f9c8524..fded5f897019ae6d071554fb2b441a583a2ce670 100644 (file)
@@ -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 <qapplication.h>
 #include <qpaintdevicemetrics.h>
+#include <qtranslator.h>
+#include <qtextcodec.h>
 
 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;