Le dimanche 8 Août 2004 14:15, Georg Baum a écrit :
> It works if you make the translator static:

Thanks to Georg's help, I got it to work in a satisfactory way.

I propose to apply this. The only problem I see is that when the locale is
ar (arabic) or iw (hebrew[*]), all the interface is changed to be 
right-to-left, which looks a bit stupid considering that LyX does not have 
a proper localization for these languages. RtL users, your input is welcome:
what should we do here?

JMarc
Index: src/frontends/qt2/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/ChangeLog,v
retrieving revision 1.702
diff -u -r1.702 ChangeLog
--- src/frontends/qt2/ChangeLog	8 Aug 2004 13:17:21 -0000	1.702
+++ src/frontends/qt2/ChangeLog	8 Aug 2004 15:09:59 -0000
@@ -1,3 +1,10 @@
+2004-08-08  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* 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  <[EMAIL PROTECTED]>
 
 	* QBibtexDialog.C (browsePressed): use ControlBibtex::browseBst
Index: src/frontends/qt2/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/Makefile.am,v
retrieving revision 1.93
diff -u -r1.93 Makefile.am
--- src/frontends/qt2/Makefile.am	31 Mar 2004 22:09:51 -0000	1.93
+++ src/frontends/qt2/Makefile.am	8 Aug 2004 15:09:59 -0000
@@ -14,7 +14,7 @@
 
 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: src/frontends/qt2/lyx_gui.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/qt2/lyx_gui.C,v
retrieving revision 1.68
diff -u -r1.68 lyx_gui.C
--- src/frontends/qt2/lyx_gui.C	22 Jul 2004 13:44:40 -0000	1.68
+++ src/frontends/qt2/lyx_gui.C	8 Aug 2004 15:09:59 -0000
@@ -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,23 @@
 
 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);
+		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;
 

Reply via email to