eliot-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Eliot-dev] eliot/qt main.cpp qtcommon.h


From: Olivier Teulière
Subject: [Eliot-dev] eliot/qt main.cpp qtcommon.h
Date: Fri, 12 Feb 2010 18:16:57 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Changes by:     Olivier Teulière <ipkiss>       10/02/12 18:16:57

Modified files:
        qt             : main.cpp qtcommon.h 

Log message:
        Force the gettext() messages to be in UTF-8, because I don't know how to
        detect properly the correct encoding on Mac OS X when the LANG variable
        is not set...

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/main.cpp?cvsroot=eliot&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/eliot/qt/qtcommon.h?cvsroot=eliot&r1=1.10&r2=1.11

Patches:
Index: main.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/main.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- main.cpp    7 Feb 2010 17:34:59 -0000       1.6
+++ main.cpp    12 Feb 2010 18:16:57 -0000      1.7
@@ -72,7 +72,7 @@
     setlocale(LC_ALL, "");
 #ifdef __APPLE__
     // FIXME: Ugly hack: we hardcode the encoding to UTF-8, because I don't
-    // know how to retrieve it properly
+    // know how to retrieve it properly when LANG is not set
     setlocale(LC_CTYPE, "UTF-8");
 #endif
 #endif
@@ -98,6 +98,10 @@
     static const string localeDir = LOCALEDIR;
 #endif
     bindtextdomain(PACKAGE, localeDir.c_str());
+#ifdef __APPLE__
+    // Force messages to UTF-8
+    bind_textdomain_codeset(PACKAGE, "UTF-8");
+#endif
     textdomain(PACKAGE);
 
     // Translations for Qt's own strings

Index: qtcommon.h
===================================================================
RCS file: /cvsroot/eliot/eliot/qt/qtcommon.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- qtcommon.h  24 Jan 2010 00:53:21 -0000      1.10
+++ qtcommon.h  12 Feb 2010 18:16:57 -0000      1.11
@@ -46,7 +46,14 @@
 #define qfu(s) QString::fromUtf8(s)
 #define qtu(s) (s).toUtf8().data()
 // Translation macro to use gettext
-#define _q(s) QString::fromLocal8Bit(_(s))
+#ifdef __APPLE__
+// On MacOSX, we force the encoding to UTF-8, because we have trouble
+// detecting the current encoding properly (see call to
+// bind_textdomain_codeset() in main.cpp)
+#    define _q(s) qfu(_(s))
+#else
+#    define _q(s) QString::fromLocal8Bit(_(s))
+#endif
 
 // Used for QSettings
 #define ORGANIZATION "eliot"




reply via email to

[Prev in Thread] Current Thread [Next in Thread]