summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChoe Hwanjin <choe.hwanjin@gmail.com>2010-12-12 19:52:23 +0900
committerChoe Hwanjin <choe.hwanjin@gmail.com>2010-12-12 19:52:23 +0900
commit4ed9ac1e5fc44f20b23322b9b53be9d988adda2a (patch)
tree06c2bd9f46c72d5f7ec91592f78e013347e4ca18
parent2646bda3a5584b283190f22f32cf7ff669c925e8 (diff)
downloadlibhangul-4ed9ac1e5fc44f20b23322b9b53be9d988adda2a.tar.gz
gettext 적용
git-svn-id: http://kldp.net/svn/hangul/libhangul/trunk@229 8f00fcd2-89fc-0310-932e-b01be5b65e01
-rw-r--r--Makefile.am6
-rwxr-xr-xautogen.sh1
-rw-r--r--configure.ac12
-rw-r--r--hangul/Makefile.am1
-rw-r--r--hangul/hangul-gettext.h18
-rw-r--r--hangul/hangulinputcontext.c29
-rw-r--r--po/LINGUAS1
-rw-r--r--po/Makevars41
-rw-r--r--po/POTFILES.in5
-rw-r--r--po/ko.po49
10 files changed, 150 insertions, 13 deletions
diff --git a/Makefile.am b/Makefile.am
index 339e67d..155a401 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,9 +1,11 @@
-SUBDIRS = hangul data test
+SUBDIRS = hangul data test po
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libhangul.pc
EXTRA_DIST = \
+ config.rpath \
+ m4/ChangeLog \
doc/Makefile \
doc/Doxyfile.in \
doc/mainpage.dox
@@ -13,3 +15,5 @@ log:
export LANG=C ; \
export LC_CTYPE=ko_KR.UTF-8; \
svn log -v > ChangeLog
+
+ACLOCAL_AMFLAGS = -I m4
diff --git a/autogen.sh b/autogen.sh
index 90524b2..bc46b60 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -8,6 +8,7 @@ if test -z "$libtoolize"; then
libtoolize=libtoolize
fi
+gettextize --force --no-changelog
$libtoolize --automake
aclocal $ACLOCAL_AMFLAGS
autoheader
diff --git a/configure.ac b/configure.ac
index 3481fcf..d8bb0fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,6 +42,12 @@ AC_FUNC_REALLOC
AC_CHECK_FUNCS([munmap])
AC_CHECK_FUNCS([strcasecmp])
+# Checks for gettext stuff
+GETTEXT_PACKAGE="$PACKAGE"
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", gettext package name)
+AM_GNU_GETTEXT([external])
+
# Checks for unit test framework
PKG_PROG_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
@@ -50,12 +56,14 @@ fi
AC_CONFIG_FILES([
Makefile
-hangul/Makefile
data/Makefile
data/hanja/Makefile
-test/Makefile
doc/Doxyfile
+hangul/Makefile
libhangul.pc
+po/Makefile.in
+test/Makefile
+tools/Makefile
])
AC_OUTPUT
diff --git a/hangul/Makefile.am b/hangul/Makefile.am
index bd9770f..ad7d357 100644
--- a/hangul/Makefile.am
+++ b/hangul/Makefile.am
@@ -14,6 +14,7 @@ libhangul_la_SOURCES = \
hanja.c
libhangul_la_CFLAGS = \
+ -DLOCALEDIR=\"$(localedir)\" \
-DLIBHANGUL_DEFAULT_HANJA_DIC=\"$(datadir)/libhangul/hanja/hanja.txt\"
libhangul_la_LDFLAGS = -version-info $(LIBHANGUL_CURRENT):$(LIBHANGUL_REVISION):$(LIBHANGUL_AGE)
diff --git a/hangul/hangul-gettext.h b/hangul/hangul-gettext.h
new file mode 100644
index 0000000..05606a2
--- /dev/null
+++ b/hangul/hangul-gettext.h
@@ -0,0 +1,18 @@
+#ifndef libhangul_hangul_gettext_h
+#define libhangul_hangul_gettext_h
+
+#ifdef ENABLE_NLS
+
+#include <libintl.h>
+
+#define _(x) dgettext(GETTEXT_PACKAGE, x)
+#define N_(x) x
+
+#else /* ENABLE_NLS */
+
+#define _(x) (x)
+#define N_(x) x
+
+#endif /* ENABLE_NLS */
+
+#endif // libhangul_hangul_gettext_h
diff --git a/hangul/hangulinputcontext.c b/hangul/hangulinputcontext.c
index 40ce419..03d1c9d 100644
--- a/hangul/hangulinputcontext.c
+++ b/hangul/hangulinputcontext.c
@@ -25,6 +25,7 @@
#include <inttypes.h>
#include <limits.h>
+#include "hangul-gettext.h"
#include "hangul.h"
#include "hangulinternals.h"
@@ -263,7 +264,7 @@ static const HangulCombination hangul_combination_ahn = {
static const HangulKeyboard hangul_keyboard_2 = {
HANGUL_KEYBOARD_TYPE_JAMO,
"2",
- "Dubeolsik",
+ N_("Dubeolsik"),
(ucschar*)hangul_keyboard_table_2,
&hangul_combination_default
};
@@ -271,7 +272,7 @@ static const HangulKeyboard hangul_keyboard_2 = {
static const HangulKeyboard hangul_keyboard_32 = {
HANGUL_KEYBOARD_TYPE_JASO,
"32",
- "Sebeolsik dubeol layout",
+ N_("Sebeolsik dubeol layout"),
(ucschar*)hangul_keyboard_table_32,
&hangul_combination_default
};
@@ -279,7 +280,7 @@ static const HangulKeyboard hangul_keyboard_32 = {
static const HangulKeyboard hangul_keyboard_390 = {
HANGUL_KEYBOARD_TYPE_JASO,
"39",
- "Sebeolsik 390",
+ N_("Sebeolsik 390"),
(ucschar*)hangul_keyboard_table_390,
&hangul_combination_default
};
@@ -287,15 +288,15 @@ static const HangulKeyboard hangul_keyboard_390 = {
static const HangulKeyboard hangul_keyboard_3final = {
HANGUL_KEYBOARD_TYPE_JASO,
"3f",
- "Sebeolsik final",
+ N_("Sebeolsik final"),
(ucschar*)hangul_keyboard_table_3final,
&hangul_combination_default
};
static const HangulKeyboard hangul_keyboard_3sun = {
HANGUL_KEYBOARD_TYPE_JASO,
- "3sun",
- "Sebeolsik no-shift",
+ "3s",
+ N_("Sebeolsik no-shift"),
(ucschar*)hangul_keyboard_table_3sun,
&hangul_combination_default
};
@@ -303,7 +304,7 @@ static const HangulKeyboard hangul_keyboard_3sun = {
static const HangulKeyboard hangul_keyboard_3yet = {
HANGUL_KEYBOARD_TYPE_JASO,
"3y",
- "Sebeolsik yetgeul",
+ N_("Sebeolsik yetgeul"),
(ucschar*)hangul_keyboard_table_3yet,
&hangul_combination_full
};
@@ -311,7 +312,7 @@ static const HangulKeyboard hangul_keyboard_3yet = {
static const HangulKeyboard hangul_keyboard_romaja = {
HANGUL_KEYBOARD_TYPE_ROMAJA,
"ro",
- "Romaja",
+ N_("Romaja"),
(ucschar*)hangul_keyboard_table_romaja,
&hangul_combination_romaja
};
@@ -319,7 +320,7 @@ static const HangulKeyboard hangul_keyboard_romaja = {
static const HangulKeyboard hangul_keyboard_ahn = {
HANGUL_KEYBOARD_TYPE_JASO,
"ahn",
- "Ahnmatae",
+ N_("Ahnmatae"),
(ucschar*)hangul_keyboard_table_ahn,
&hangul_combination_ahn
};
@@ -1770,8 +1771,16 @@ hangul_ic_get_keyboard_id(unsigned index_)
const char*
hangul_ic_get_keyboard_name(unsigned index_)
{
+#ifdef ENABLE_NLS
+ static bool isGettextInitialized = false;
+ if (!isGettextInitialized) {
+ isGettextInitialized = true;
+ bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
+ }
+#endif
+
if (index_ < N_ELEMENTS(hangul_keyboards)) {
- return hangul_keyboards[index_]->name;
+ return _(hangul_keyboards[index_]->name);
}
return NULL;
diff --git a/po/LINGUAS b/po/LINGUAS
new file mode 100644
index 0000000..d031295
--- /dev/null
+++ b/po/LINGUAS
@@ -0,0 +1 @@
+ko
diff --git a/po/Makevars b/po/Makevars
new file mode 100644
index 0000000..f7ed7fa
--- /dev/null
+++ b/po/Makevars
@@ -0,0 +1,41 @@
+# Makefile variables for PO directory in any package using GNU gettext.
+
+# Usually the message domain is the same as the package name.
+DOMAIN = $(PACKAGE)
+
+# These two variables depend on the location of this directory.
+subdir = po
+top_builddir = ..
+
+# These options get passed to xgettext.
+XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
+
+# This is the copyright holder that gets inserted into the header of the
+# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
+# package. (Note that the msgstr strings, extracted from the package's
+# sources, belong to the copyright holder of the package.) Translators are
+# expected to transfer the copyright for their translations to this person
+# or entity, or to disclaim their copyright. The empty string stands for
+# the public domain; in this case the translators are expected to disclaim
+# their copyright.
+COPYRIGHT_HOLDER = Free Software Foundation, Inc.
+
+# This is the email address or URL to which the translators shall report
+# bugs in the untranslated strings:
+# - Strings which are not entire sentences, see the maintainer guidelines
+# in the GNU gettext documentation, section 'Preparing Strings'.
+# - Strings which use unclear terms or require additional context to be
+# understood.
+# - Strings which make invalid assumptions about notation of date, time or
+# money.
+# - Pluralisation problems.
+# - Incorrect English spelling.
+# - Incorrect formatting.
+# It can be your email address, or a mailing list address where translators
+# can write to without being subscribed, or the URL of a web page through
+# which the translators can contact you.
+MSGID_BUGS_ADDRESS = http://kldp.net/projects/hangul
+
+# This is the list of locale categories, beyond LC_MESSAGES, for which the
+# message catalogs shall be used. It is usually empty.
+EXTRA_LOCALE_CATEGORIES =
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644
index 0000000..82fae4c
--- /dev/null
+++ b/po/POTFILES.in
@@ -0,0 +1,5 @@
+# List of source files which contain translatable strings.
+
+hangul/hangulctype.c
+hangul/hangulinputcontext.c
+hangul/hanja.c
diff --git a/po/ko.po b/po/ko.po
new file mode 100644
index 0000000..949bce8
--- /dev/null
+++ b/po/ko.po
@@ -0,0 +1,49 @@
+# libhangul korean translation
+# Copyright (C) 2010 Free Software Foundation, Inc.
+# This file is distributed under the same license as the libhangul package.
+# Choe Hwanjin <choe.hwanjin@gmail.com>, 2010.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: libhangul 0.0.11\n"
+"Report-Msgid-Bugs-To: http://kldp.net/projects/hangul\n"
+"POT-Creation-Date: 2010-11-14 21:21+0900\n"
+"PO-Revision-Date: 2010-11-14 21:34+0900\n"
+"Last-Translator: Choe Hwanjin <choe.hwanjin@gmail.com>\n"
+"Language-Team: Korean <ko@li.org>\n"
+"Language: ko\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: hangul/hangulinputcontext.c:267
+msgid "Dubeolsik"
+msgstr "두벌식"
+
+#: hangul/hangulinputcontext.c:275
+msgid "Sebeolsik dubeol layout"
+msgstr "두벌식 세벌 자판"
+
+#: hangul/hangulinputcontext.c:283
+msgid "Sebeolsik 390"
+msgstr "세벌식 390"
+
+#: hangul/hangulinputcontext.c:291
+msgid "Sebeolsik final"
+msgstr "세벌식 최종"
+
+#: hangul/hangulinputcontext.c:299
+msgid "Sebeolsik no-shift"
+msgstr "세벌식 순아래"
+
+#: hangul/hangulinputcontext.c:307
+msgid "Sebeolsik yetgeul"
+msgstr "세벌식 옛글"
+
+#: hangul/hangulinputcontext.c:315
+msgid "Romaja"
+msgstr "로마자"
+
+#: hangul/hangulinputcontext.c:323
+msgid "Ahnmatae"
+msgstr "안마태"