change hanja mode label
authorChoe Hwanjin <choe.hwanjin@gmail.com>
Sat, 31 Oct 2009 07:47:31 +0000 (16:47 +0900)
committerChoe Hwanjin <choe.hwanjin@gmail.com>
Sat, 31 Oct 2009 07:47:31 +0000 (16:47 +0900)
    * change the button label to 'Hanja lock'
    * use gettext package for translation
    * update po files

po/ko.po
po/zh_CN.po
src/Makefile.am
src/engine.c
src/i18n.h [new file with mode: 0644]
src/main.c

index a93bf81..f28865e 100644 (file)
--- a/po/ko.po
+++ b/po/ko.po
@@ -7,10 +7,10 @@ msgid ""
 msgstr ""
 "Project-Id-Version: ibus-hangul\n"
 "Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n"
-"POT-Creation-Date: 2009-10-16 22:29+0900\n"
+"POT-Creation-Date: 2009-10-31 16:11+0900\n"
 "PO-Revision-Date: 2009-02-18 23:32+0900\n"
 "Last-Translator: Choe Hwanjin <choe.hwanjin@gmail.com>\n"
-"Language-Team: LANGUAGE <ko@li.org>\n"
+"Language-Team: korean <ko@li.org>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
@@ -51,10 +51,26 @@ msgstr "<b>자판 설정</b>"
 msgid "_Hangul keyboard:"
 msgstr "한글 자판(_H)"
 
-#: src/main.c:48
+#: src/engine.c:216
+msgid "Hanja lock"
+msgstr "한자 전용"
+
+#: src/engine.c:217
+msgid "Enable/Disable Hanja mode"
+msgstr "한자 전용 모드 선택합니다"
+
+#: src/engine.c:229
+msgid "Setup"
+msgstr "설정"
+
+#: src/engine.c:230
+msgid "Configure hangul engine"
+msgstr "한글 입력기를 설정합니다"
+
+#: src/main.c:52
 msgid "Hangul input method"
 msgstr "한글 입력기"
 
-#: src/main.c:57 src/main.c:58
+#: src/main.c:61 src/main.c:62
 msgid "Hangul Input Method"
 msgstr "한글 입력기"
index bc60b35..18baeeb 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: http://code.google.com/p/ibus/issues/entry\n"
-"POT-Creation-Date: 2009-10-16 22:29+0900\n"
+"POT-Creation-Date: 2009-10-31 16:11+0900\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -52,10 +52,26 @@ msgstr ""
 msgid "_Hangul keyboard:"
 msgstr ""
 
-#: src/main.c:48
+#: src/engine.c:216
+msgid "Hanja lock"
+msgstr ""
+
+#: src/engine.c:217
+msgid "Enable/Disable Hanja mode"
+msgstr ""
+
+#: src/engine.c:229
+msgid "Setup"
+msgstr ""
+
+#: src/engine.c:230
+msgid "Configure hangul engine"
+msgstr ""
+
+#: src/main.c:52
 msgid "Hangul input method"
 msgstr ""
 
-#: src/main.c:57 src/main.c:58
+#: src/main.c:61 src/main.c:62
 msgid "Hangul Input Method"
 msgstr ""
index da909e8..fc86796 100644 (file)
@@ -49,6 +49,7 @@ ibus_engine_hangul_CFLAGS = \
        @IBUS_CFLAGS@ \
        @HANGUL_CFLAGS@ \
        -DPKGDATADIR=\"$(pkgdatadir)\" \
+       -DLOCALEDIR=\"$(localedir)\" \
        -DLIBEXECDIR=\"$(libexecdir)\" \
        -DIBUSHANGUL_DATADIR=\"$(datadir)/ibus-hangul\" \
        $(NULL)
index 20a728f..cdc19ce 100644 (file)
@@ -1,12 +1,17 @@
 /* vim:set et sts=4: */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <ibus.h>
 #include <hangul.h>
 #include <string.h>
 
+#include "i18n.h"
 #include "engine.h"
 #include "ustring.h"
 
+
 typedef struct _IBusHangulEngine IBusHangulEngine;
 typedef struct _IBusHangulEngineClass IBusHangulEngineClass;
 
@@ -208,10 +213,10 @@ ibus_hangul_engine_init (IBusHangulEngine *hangul)
 
     hangul->prop_list = ibus_prop_list_new ();
 
-    label = ibus_text_new_from_static_string ("韓");
-    tooltip = ibus_text_new_from_static_string ("Enable/Disable Hanja mode");
+    label = ibus_text_new_from_string (_("Hanja lock"));
+    tooltip = ibus_text_new_from_string (_("Enable/Disable Hanja mode"));
     prop = ibus_property_new ("hanja_mode",
-                              PROP_TYPE_NORMAL,
+                              PROP_TYPE_TOGGLE,
                               label,
                              NULL,
                               tooltip,
@@ -221,8 +226,8 @@ ibus_hangul_engine_init (IBusHangulEngine *hangul)
     ibus_prop_list_append (hangul->prop_list, prop);
     hangul->prop_hanja_mode = prop;
 
-    label = ibus_text_new_from_static_string ("Setup");
-    tooltip = ibus_text_new_from_static_string ("Configure hangul engine");
+    label = ibus_text_new_from_string (_("Setup"));
+    tooltip = ibus_text_new_from_string (_("Configure hangul engine"));
     prop = ibus_property_new ("setup",
                               PROP_TYPE_NORMAL,
                               label,
@@ -661,14 +666,11 @@ ibus_hangul_engine_focus_in (IBusEngine *engine)
 {
     IBusHangulEngine *hangul = (IBusHangulEngine *) engine;
 
-    IBusText* label = NULL;
     if (hangul->hanja_mode) {
-       label = ibus_text_new_from_static_string("漢");
+       hangul->prop_hanja_mode->state = PROP_STATE_CHECKED;
     } else {
-       label = ibus_text_new_from_static_string("韓");
+       hangul->prop_hanja_mode->state = PROP_STATE_UNCHECKED;
     }
-    ibus_property_set_label (hangul->prop_hanja_mode, label);
-    g_object_unref (label);
 
     ibus_engine_register_properties (engine, hangul->prop_list);
 
@@ -780,21 +782,15 @@ ibus_hangul_engine_property_activate (IBusEngine    *engine,
        g_free(path);
     } else if (strcmp(prop_name, "hanja_mode") == 0) {
        IBusHangulEngine *hangul = (IBusHangulEngine *) engine;
-       IBusText *label;
 
        hangul->hanja_mode = !hangul->hanja_mode;
-
        if (hangul->hanja_mode) {
-           label = ibus_text_new_from_static_string("漢");
            hangul->prop_hanja_mode->state = PROP_STATE_CHECKED;
        } else {
-           label = ibus_text_new_from_static_string("韓");
            hangul->prop_hanja_mode->state = PROP_STATE_UNCHECKED;
        }
 
-       ibus_property_set_label (hangul->prop_hanja_mode, label);
        ibus_engine_update_property (engine, hangul->prop_hanja_mode);
-       g_object_unref(label);
     }
 }
 
diff --git a/src/i18n.h b/src/i18n.h
new file mode 100644 (file)
index 0000000..56dc814
--- /dev/null
@@ -0,0 +1,11 @@
+/* vim:set et sts=4: */
+
+#ifndef ibus_hangul_i18n_h
+#define ibus_hangul_i18n_h
+
+#include <libintl.h>
+
+#define _(str)     gettext(str)
+#define N_(str)            (str)
+
+#endif /* ibus_hangul_i18n_h */
index cc4dda7..5a3a556 100644 (file)
@@ -1,12 +1,16 @@
 /* vim:set et sts=4: */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <ibus.h>
 #include <stdlib.h>
 #include <locale.h>
 #include <hangul.h>
+
+#include "i18n.h"
 #include "engine.h"
 
-#define N_(text) text
 
 static IBusBus *bus = NULL;
 static IBusFactory *factory = NULL;
@@ -88,6 +92,10 @@ main (gint argc, gchar **argv)
 
     setlocale (LC_ALL, "");
 
+    bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
+    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+    textdomain(GETTEXT_PACKAGE);
+
     context = g_option_context_new ("- ibus hangul engine component");
 
     g_option_context_add_main_entries (context, entries, "ibus-hangul");