[uim-commit] r483 - trunk/qt

kzk at freedesktop.org kzk at freedesktop.org
Wed Feb 2 11:13:42 PST 2005


Author: kzk
Date: 2005-02-02 11:13:39 -0800 (Wed, 02 Feb 2005)
New Revision: 483

Added:
   trunk/qt/qtgettext.h
Modified:
   trunk/qt/candwin-qt.cpp
   trunk/qt/pref-customwidgets.cpp
   trunk/qt/pref-qt.cpp
   trunk/qt/switcher-qt.cpp
   trunk/qt/toolbar-common-quimhelpertoolbar.cpp
   trunk/qt/toolbar-standalone-qt.cpp
Log:
* Handle encoding of gettext string properly.
  Specify encoding by bind_textdomain_codeset, and _(
  macro is replaced in qtgettext.h

* qt/candwin-qt.cpp
* qt/pref-qt.cpp
* qt/pref-customwidgets.cpp
* qt/switcher-qt.cpp
* qt/toolbar-standalone-qt.cpp
* qt/toolbar-common-quimhelpertoolbar.cpp
  - include "qtgettext.h" instead of "uim/gettext.h"
  - call bind_textdomain_codeset

* qt/qtgettext.h
  - new file


Modified: trunk/qt/candwin-qt.cpp
===================================================================
--- trunk/qt/candwin-qt.cpp	2005-02-02 17:23:18 UTC (rev 482)
+++ trunk/qt/candwin-qt.cpp	2005-02-02 19:13:39 UTC (rev 483)
@@ -46,8 +46,8 @@
 #include <unistd.h>
 
 #include "uim/config.h"
-#include "uim/gettext.h"
 
+#include "qtgettext.h"
 #include "candwin-qt.h"
 
 static const int NR_CANDIDATES = 10;
@@ -455,7 +455,8 @@
     setlocale(LC_ALL, "");
     bindtextdomain(PACKAGE, LOCALEDIR);
     textdomain(PACKAGE);
-
+    bind_textdomain_codeset(PACKAGE, "UTF-8"); // ensure code encoding is UTF8-
+    
     QApplication a( argc, argv );
 
     CandidateWindow b;

Modified: trunk/qt/pref-customwidgets.cpp
===================================================================
--- trunk/qt/pref-customwidgets.cpp	2005-02-02 17:23:18 UTC (rev 482)
+++ trunk/qt/pref-customwidgets.cpp	2005-02-02 19:13:39 UTC (rev 483)
@@ -35,7 +35,7 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-#include "uim/gettext.h"
+#include "qtgettext.h"
 
 #define _FU8(String) QString::fromUtf8(String)
 

Modified: trunk/qt/pref-qt.cpp
===================================================================
--- trunk/qt/pref-qt.cpp	2005-02-02 17:23:18 UTC (rev 482)
+++ trunk/qt/pref-qt.cpp	2005-02-02 19:13:39 UTC (rev 483)
@@ -55,8 +55,9 @@
 #include <qobjectlist.h>
 
 #include "uim/config.h"
-#include "uim/gettext.h"
 
+#include "qtgettext.h"
+
 #include <unistd.h>
 #include <stdlib.h>
 #include <locale.h>

Added: trunk/qt/qtgettext.h
===================================================================
--- trunk/qt/qtgettext.h	2005-02-02 17:23:18 UTC (rev 482)
+++ trunk/qt/qtgettext.h	2005-02-02 19:13:39 UTC (rev 483)
@@ -0,0 +1,27 @@
+#ifndef _QT_GETTEXT_H_
+#define _QT_GETTEXT_H_
+
+#include "uim/config.h"
+
+/* NLS can be disabled through the configure --disable-nls option.  */
+#if ENABLE_NLS
+
+#include "uim/gettext.h"
+/* undef original _(String) macro for handling encoding */
+#ifdef _
+#undef _
+#endif
+#define _(String) QString::fromUtf8( dgettext(GETTEXT_PACKAGE,String) )
+/* undef original N_(String) macro for handling encoding */
+#ifdef N_
+#undef N_
+#endif
+#ifdef gettext_noop
+#define N_(String) gettext_noop(String)
+#else
+#define N_(String) (String)
+#endif /* gettext_noop */
+
+#endif /* ENABLE_NLS */
+
+#endif /* Not def: _QT_GETTEXT_H_ */

Modified: trunk/qt/switcher-qt.cpp
===================================================================
--- trunk/qt/switcher-qt.cpp	2005-02-02 17:23:18 UTC (rev 482)
+++ trunk/qt/switcher-qt.cpp	2005-02-02 19:13:39 UTC (rev 483)
@@ -46,7 +46,7 @@
 #include <locale.h>
 
 #include "uim/config.h"
-#include "uim/gettext.h"
+#include "qtgettext.h"
 
 #define NAME_COLUMN 0
 
@@ -58,6 +58,7 @@
     setlocale(LC_ALL, "");
     bindtextdomain(PACKAGE, LOCALEDIR);
     textdomain(PACKAGE);
+    bind_textdomain_codeset(PACKAGE, "UTF-8"); // ensure code encoding is UTF8-
     
     QApplication a( argc, argv );
 

Modified: trunk/qt/toolbar-common-quimhelpertoolbar.cpp
===================================================================
--- trunk/qt/toolbar-common-quimhelpertoolbar.cpp	2005-02-02 17:23:18 UTC (rev 482)
+++ trunk/qt/toolbar-common-quimhelpertoolbar.cpp	2005-02-02 19:13:39 UTC (rev 483)
@@ -38,7 +38,7 @@
 
 #include <stdlib.h>
 
-#include "uim/gettext.h"
+#include "qtgettext.h"
 
 QUimHelperToolbar::QUimHelperToolbar( QWidget *parent, const char *name, WFlags f )
         : QHBox( parent, name, f )

Modified: trunk/qt/toolbar-standalone-qt.cpp
===================================================================
--- trunk/qt/toolbar-standalone-qt.cpp	2005-02-02 17:23:18 UTC (rev 482)
+++ trunk/qt/toolbar-standalone-qt.cpp	2005-02-02 19:13:39 UTC (rev 483)
@@ -42,7 +42,7 @@
 #include <locale.h>
 
 #include "uim/config.h"
-#include "uim/gettext.h"
+#include "qtgettext.h"
 
 UimToolbarDraggingHandler::UimToolbarDraggingHandler( QWidget *parent,
         const char* name )
@@ -96,6 +96,7 @@
     setlocale(LC_ALL, "");
     bindtextdomain(PACKAGE, LOCALEDIR);
     textdomain(PACKAGE);
+    bind_textdomain_codeset(PACKAGE, "UTF-8"); // ensure code encoding is UTF8-
     
     QApplication a( argc, argv );
 



More information about the Uim-commit mailing list