[uim-commit] r473 - trunk/qt

kzk at freedesktop.org kzk at freedesktop.org
Tue Feb 1 15:22:33 PST 2005


Author: kzk
Date: 2005-02-01 15:22:29 -0800 (Tue, 01 Feb 2005)
New Revision: 473

Modified:
   trunk/qt/Makefile.am
   trunk/qt/candwin-qt.cpp
   trunk/qt/pref-customwidgets.cpp
   trunk/qt/pref-qt.cpp
   trunk/qt/pref-qt.h
   trunk/qt/switcher-qt.cpp
   trunk/qt/toolbar-common-quimhelpertoolbar.cpp
   trunk/qt/toolbar-standalone-qt.cpp
Log:
* Internationalize by using uim's gettext system

* qt/candwin-qt.cpp
* qt/toolbar-standalone-qt.cpp
* qt/switcher-qt.cpp
* qt/pref-qt.cpp
* qt/pref-qt.h
* qt/toolbar-common-quimhelpertoolbar.cpp
* qt/Makefile.am
* qt/pref-customwidgets.cpp
  - internationalize



Modified: trunk/qt/Makefile.am
===================================================================
--- trunk/qt/Makefile.am	2005-02-01 23:06:55 UTC (rev 472)
+++ trunk/qt/Makefile.am	2005-02-01 23:22:29 UTC (rev 473)
@@ -1,3 +1,4 @@
+INCLUDES        = -I$(top_srcdir) -I$(top_builddir)
 CXXFLAGS        += $(UIM_QT_CFLAGS)
 CFLAGS          += $(UIM_QT_CFLAGS)
 

Modified: trunk/qt/candwin-qt.cpp
===================================================================
--- trunk/qt/candwin-qt.cpp	2005-02-01 23:06:55 UTC (rev 472)
+++ trunk/qt/candwin-qt.cpp	2005-02-01 23:22:29 UTC (rev 473)
@@ -39,11 +39,15 @@
 #include <qtextcodec.h>
 #include <qrect.h>
 
+#include <locale.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
+#include "uim/config.h"
+#include "uim/gettext.h"
+
 #include "candwin-qt.h"
 
 static const int NR_CANDIDATES = 10;
@@ -448,6 +452,10 @@
 
 int main( int argc, char *argv[] )
 {
+    setlocale(LC_ALL, "");
+    bindtextdomain(PACKAGE, LOCALEDIR);
+    textdomain(PACKAGE);
+
     QApplication a( argc, argv );
 
     CandidateWindow b;

Modified: trunk/qt/pref-customwidgets.cpp
===================================================================
--- trunk/qt/pref-customwidgets.cpp	2005-02-01 23:06:55 UTC (rev 472)
+++ trunk/qt/pref-customwidgets.cpp	2005-02-01 23:22:29 UTC (rev 473)
@@ -35,6 +35,8 @@
 #include <stdlib.h>
 #include <ctype.h>
 
+#include "uim/gettext.h"
+
 #define _FU8(String) QString::fromUtf8(String)
 
 CustomCheckBox::CustomCheckBox( struct uim_custom *c, QWidget *parent, const char *name )
@@ -172,7 +174,7 @@
                       this, SLOT(slotCustomTextChanged(const QString &)) );
 
     m_fileButton = new QToolButton( this );
-    m_fileButton->setText( "File" );
+    m_fileButton->setText( _("File") );
     QObject::connect( m_fileButton, SIGNAL(clicked()),
                       this, SLOT(slotPathnameButtonClicked()) );
 
@@ -314,7 +316,7 @@
     m_lineEdit->setReadOnly( true );
 
     m_editButton = new QToolButton( this );
-    m_editButton->setText( "Edit" );
+    m_editButton->setText( _("Edit") );
     QObject::connect( m_editButton, SIGNAL(clicked()),
                       this, SLOT(slotEditButtonClicked()) );
 
@@ -597,7 +599,7 @@
     m_lineEdit->setReadOnly( false );
 
     m_editButton = new QToolButton( this );
-    m_editButton->setText( "Edit" );
+    m_editButton->setText( _("Edit") );
     QObject::connect( m_editButton, SIGNAL(clicked()),
                       this, SLOT(slotKeyButtonClicked()) );
 

Modified: trunk/qt/pref-qt.cpp
===================================================================
--- trunk/qt/pref-qt.cpp	2005-02-01 23:06:55 UTC (rev 472)
+++ trunk/qt/pref-qt.cpp	2005-02-01 23:22:29 UTC (rev 473)
@@ -54,17 +54,12 @@
 #include <qlayout.h>
 #include <qobjectlist.h>
 
-/*
- * FIXME! : 2004-01-14 Kazuki Ohta <mover at hct.zaq.ne.jp>
- * After uim-kdehelper is merged to uim, please include these files
- * instead of including <libintl.h>
- *
- * #include "uim/config.h"
- * #include "uim/gettext.h"
- */
-#include <libintl.h>
+#include "uim/config.h"
+#include "uim/gettext.h"
+
 #include <unistd.h>
 #include <stdlib.h>
+#include <locale.h>
 
 #define _FU8(String) QString::fromUtf8(String)
 
@@ -104,7 +99,7 @@
     QSplitter *mainSplitter = new QSplitter( this );
 
     m_groupListView = new QListView( mainSplitter );
-    m_groupListView->addColumn( "Group" );
+    m_groupListView->addColumn( _("Group") );
     m_groupListView->setSelectionMode( QListView::Single );
     m_groupListView->setSorting( -1 );
     QObject::connect( m_groupListView, SIGNAL(selectionChanged( QListViewItem * )),
@@ -116,17 +111,17 @@
     m_groupWidgetStack = new QWidgetStack( leftSideWidget );
     QHBoxLayout *buttonHLayout = new QHBoxLayout( buttonHWidget );
     buttonHLayout->setSpacing( 6 );
-    QPushButton *defaultButton = new QPushButton( "Defaults", buttonHWidget );
+    QPushButton *defaultButton = new QPushButton( _("Defaults"), buttonHWidget );
     QObject::connect( defaultButton, SIGNAL(clicked()),
                       this, SLOT(slotSetDefault()) );
-    QPushButton *okButton = new QPushButton( "OK", buttonHWidget );
+    QPushButton *okButton = new QPushButton( _("OK"), buttonHWidget );
     QObject::connect( okButton, SIGNAL(clicked()),
                       this, SLOT(slotOK()) );
     m_applyButton = new QPushButton( "Apply", buttonHWidget );
     m_applyButton->setEnabled( false );
     QObject::connect( m_applyButton, SIGNAL(clicked()),
                       this, SLOT(slotApply()) );
-    QPushButton *cancelButton = new QPushButton( "Cancel", buttonHWidget );
+    QPushButton *cancelButton = new QPushButton( _("Cancel"), buttonHWidget );
     QObject::connect( cancelButton, SIGNAL(clicked()),
                       this, SLOT(slotCancel()) );
     buttonHLayout->addWidget( defaultButton );
@@ -196,7 +191,7 @@
 
 void UimPrefDialog::confirmChange()
 {
-    QConfirmDialog *cDialog = new QConfirmDialog( "The value was changed.\nSave?",
+    QConfirmDialog *cDialog = new QConfirmDialog( _("The value was changed.\nSave?"),
                                                   this );
     if( cDialog->exec() == QDialog::Accepted )
     {
@@ -259,8 +254,8 @@
     vLayout->setMargin( 10 );
     QLabel *msgLabel = new QLabel( msg, this );
     QHBox *buttonHBox = new QHBox( this );
-    QPushButton *okButton = new QPushButton( "OK", buttonHBox );
-    QPushButton *cancelButton = new QPushButton( "Cancel", buttonHBox );
+    QPushButton *okButton = new QPushButton( _("OK"), buttonHBox );
+    QPushButton *cancelButton = new QPushButton( _("Cancel"), buttonHBox );
     vLayout->addWidget( msgLabel );
     vLayout->addWidget( buttonHBox );
 
@@ -546,13 +541,10 @@
 //--------------------------------------------------------------------------------------
 int main( int argc, char **argv )
 {
-    /*
-     * FIXME! : 2004-01-14 Kazuki Ohta <mover at hct.zaq.ne.jp>
-     * After uim-kdehelper is merged to uim, please use PACKAGE
-     * instead of "uim"
-     */
-    // ensure code encoding is UTF-8
-    bind_textdomain_codeset( "uim", "UTF-8" );
+    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/pref-qt.h
===================================================================
--- trunk/qt/pref-qt.h	2005-02-01 23:06:55 UTC (rev 472)
+++ trunk/qt/pref-qt.h	2005-02-01 23:22:29 UTC (rev 473)
@@ -49,13 +49,9 @@
 #include <uim/uim.h>
 #include <uim/uim-custom.h>
 
+
 class UimCustomItemIface;
 
-static const char * tr(const char *str)
-{
-    return str;
-}
-
 class UimPrefDialog : public QDialog
 {
     Q_OBJECT

Modified: trunk/qt/switcher-qt.cpp
===================================================================
--- trunk/qt/switcher-qt.cpp	2005-02-01 23:06:55 UTC (rev 472)
+++ trunk/qt/switcher-qt.cpp	2005-02-01 23:22:29 UTC (rev 473)
@@ -43,8 +43,11 @@
 #include <qlayout.h>
 #include <qsizepolicy.h>
 
-#define i18n(string) (string)
+#include <locale.h>
 
+#include "uim/config.h"
+#include "uim/gettext.h"
+
 #define NAME_COLUMN 0
 
 static int uim_fd;
@@ -52,11 +55,15 @@
 
 int main( int argc, char **argv )
 {
+    setlocale(LC_ALL, "");
+    bindtextdomain(PACKAGE, LOCALEDIR);
+    textdomain(PACKAGE);
+    
     QApplication a( argc, argv );
 
     UimImSwitcher switcher;
     switcher.resize( 550, 400 );
-    switcher.setCaption( i18n( "uim input method switcher" ) );
+    switcher.setCaption( _( "uim input method switcher" ) );
     a.setMainWidget( &switcher );
     switcher.show();
 
@@ -87,29 +94,29 @@
     /* im list view */
     listview = new QListView( this );
     listview->setSelectionMode( QListView::Single );
-    listview->addColumn( i18n( "InputMethodName" ) );
-    listview->addColumn( i18n( "Language" ) );
-    listview->addColumn( i18n( "Description" ) );
+    listview->addColumn( _( "InputMethodName" ) );
+    listview->addColumn( _( "Language" ) );
+    listview->addColumn( _( "Description" ) );
 
     /* radio buttons for changing way*/
     QRadioButton *button;
-    vbGroup = new QVButtonGroup( i18n( "Changing way" ), this );
-    button = new QRadioButton( i18n( "Change whole desktop" ), vbGroup );
+    vbGroup = new QVButtonGroup( _( "Changing way" ), this );
+    button = new QRadioButton( _( "Change whole desktop" ), vbGroup );
     vbGroup->insert( button, ID_CHANGE_WHOLE_DESKTOP );
     button->setChecked( TRUE ); // default is "Change whole desktop"
-    button = new QRadioButton( i18n( "Change this application only" ), vbGroup );
+    button = new QRadioButton( _( "Change this application only" ), vbGroup );
     vbGroup->insert( button, ID_CHANGE_THIS_APPLICATION_ONLY );
-    button = new QRadioButton( i18n( "Change this text area only" ), vbGroup );
+    button = new QRadioButton( _( "Change this text area only" ), vbGroup );
     vbGroup->insert( button, ID_CHANGE_THIS_TEXT_AREA_ONLY );
 
     /* cancel & ok button */
     okButton = new QToolButton( this );
-    okButton->setText( i18n( "OK" ) );
+    okButton->setText( _( "OK" ) );
     okButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
     QObject::connect( okButton, SIGNAL( clicked() ),
                       this, SLOT( slotChangeInputMethod() ) );
     cancelButton = new QToolButton( this );
-    cancelButton->setText( i18n( "Cancel" ) );
+    cancelButton->setText( _( "Cancel" ) );
     cancelButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
     QObject::connect( cancelButton, SIGNAL( clicked() ),
                       qApp, SLOT( quit() ) );

Modified: trunk/qt/toolbar-common-quimhelpertoolbar.cpp
===================================================================
--- trunk/qt/toolbar-common-quimhelpertoolbar.cpp	2005-02-01 23:06:55 UTC (rev 472)
+++ trunk/qt/toolbar-common-quimhelpertoolbar.cpp	2005-02-01 23:22:29 UTC (rev 473)
@@ -38,7 +38,7 @@
 
 #include <stdlib.h>
 
-#define i18n(string) (string)
+#include "uim/gettext.h"
 
 QUimHelperToolbar::QUimHelperToolbar( QWidget *parent, const char *name, WFlags f )
         : QHBox( parent, name, f )
@@ -58,10 +58,10 @@
 void QUimHelperToolbar::addExecImSwitcherButton()
 {
     QToolButton * swbutton = new QToolButton( this );
-    swbutton->setText( i18n( "sw" ) );
+    swbutton->setText( _( "sw" ) );
     QObject::connect( swbutton, SIGNAL( clicked() ),
                       this, SLOT( slotExecSwitcher() ) );
-    QToolTip::add( swbutton, i18n( "exec im-switcher" ) );
+    QToolTip::add( swbutton, _( "exec im-switcher" ) );
 }
 
 
@@ -75,10 +75,10 @@
 {
 #ifdef USE_KASUMI
     QToolButton * kasumiButton = new QToolButton( this );
-    kasumiButton->setText( i18n( "Kasumi" ) );
+    kasumiButton->setText( _( "Kasumi" ) );
     QObject::connect( kasumiButton, SIGNAL( clicked() ),
                       this, SLOT( slotExecKasumi() ) );
-    QToolTip::add( kasumiButton, i18n( "exec Kasumi" ) );
+    QToolTip::add( kasumiButton, _( "exec Kasumi" ) );
 #endif
 }
 

Modified: trunk/qt/toolbar-standalone-qt.cpp
===================================================================
--- trunk/qt/toolbar-standalone-qt.cpp	2005-02-01 23:06:55 UTC (rev 472)
+++ trunk/qt/toolbar-standalone-qt.cpp	2005-02-01 23:22:29 UTC (rev 473)
@@ -39,6 +39,11 @@
 #include <qstyle.h>
 #include <qcursor.h>
 
+#include <locale.h>
+
+#include "uim/config.h"
+#include "uim/gettext.h"
+
 UimToolbarDraggingHandler::UimToolbarDraggingHandler( QWidget *parent,
         const char* name )
         : QFrame( parent, name ),
@@ -88,6 +93,10 @@
 
 int main( int argc, char *argv[] )
 {
+    setlocale(LC_ALL, "");
+    bindtextdomain(PACKAGE, LOCALEDIR);
+    textdomain(PACKAGE);
+    
     QApplication a( argc, argv );
 
     QHBox toolbar( 0, 0, Qt::WStyle_NoBorder | Qt::WX11BypassWM );



More information about the Uim-commit mailing list