svn rev #24959: trunk/src/ config/ include/ lib/krb5/ po/
ghudson@MIT.EDU
ghudson at MIT.EDU
Fri Jun 10 14:17:12 EDT 2011
http://src.mit.edu/fisheye/changelog/krb5/?cs=24959
Commit By: ghudson
Log Message:
ticket: 6918
Add localization infrastructure.
Adds build system logic, translation macros in k5-platform.h, and
bindtextdomain calls in libkrb5 initialization.
Changed Files:
U trunk/src/Makefile.in
U trunk/src/config/pre.in
U trunk/src/configure.in
U trunk/src/include/k5-err.h
U trunk/src/include/k5-platform.h
U trunk/src/lib/krb5/Makefile.in
U trunk/src/lib/krb5/krb5_libinit.c
A trunk/src/po/
A trunk/src/po/Makefile.in
A trunk/src/po/deps
A trunk/src/po/en_US.po
A trunk/src/po/mit-krb5.pot
Modified: trunk/src/Makefile.in
===================================================================
--- trunk/src/Makefile.in 2011-06-10 15:45:13 UTC (rev 24958)
+++ trunk/src/Makefile.in 2011-06-10 18:17:12 UTC (rev 24959)
@@ -15,7 +15,7 @@
plugins/preauth/pkinit \
plugins/preauth/encrypted_challenge \
kdc kadmin slave clients appl tests \
- config-files gen-manpages
+ config-files gen-manpages po
WINSUBDIRS=include util lib ccapi windows clients appl
BUILDTOP=$(REL).
LOCALINCLUDES = -I$(srcdir)
Modified: trunk/src/config/pre.in
===================================================================
--- trunk/src/config/pre.in 2011-06-10 15:45:13 UTC (rev 24958)
+++ trunk/src/config/pre.in 2011-06-10 18:17:12 UTC (rev 24959)
@@ -216,6 +216,7 @@
KRB5_PA_MODULE_DIR = $(MODULE_DIR)/preauth
KRB5_AD_MODULE_DIR = $(MODULE_DIR)/authdata
KRB5_LIBKRB5_MODULE_DIR = $(MODULE_DIR)/libkrb5
+KRB5_LOCALEDIR = @localedir@
GSS_MODULE_DIR = @libdir@/gss
KRB5_INCSUBDIRS = \
$(KRB5_INCDIR)/kadm5 \
Modified: trunk/src/configure.in
===================================================================
--- trunk/src/configure.in 2011-06-10 15:45:13 UTC (rev 24958)
+++ trunk/src/configure.in 2011-06-10 18:17:12 UTC (rev 24959)
@@ -66,6 +66,12 @@
LIBUTIL=-lutil
])
AC_SUBST(LIBUTIL)
+
+AC_CHECK_HEADER(libintl.h, [
+ AC_SEARCH_LIBS(dgettext, intl, [
+ AC_DEFINE(ENABLE_NLS, 1,
+ [Define if translation functions should be used.])])])
+
# for kdc
AC_CHECK_HEADERS(syslog.h sys/sockio.h ifaddrs.h unistd.h)
AC_CHECK_FUNCS(openlog syslog closelog strftime vsprintf vasprintf vsnprintf)
@@ -1161,4 +1167,5 @@
tests/verify tests/gssapi tests/dejagnu tests/threads tests/shlib
tests/gss-threads tests/misc tests/mkeystash_compat
util/gss-kernel-lib util/collected-client-lib
+ po
)
Modified: trunk/src/include/k5-err.h
===================================================================
--- trunk/src/include/k5-err.h 2011-06-10 15:45:13 UTC (rev 24958)
+++ trunk/src/include/k5-err.h 2011-06-10 18:17:12 UTC (rev 24959)
@@ -32,10 +32,6 @@
#ifndef K5_ERR_H
#define K5_ERR_H
-#ifndef _
-#define _(X) (X)
-#endif
-
#if defined(_MSDOS) || defined(_WIN32)
#include <win-mac.h>
#endif
Modified: trunk/src/include/k5-platform.h
===================================================================
--- trunk/src/include/k5-platform.h 2011-06-10 15:45:13 UTC (rev 24958)
+++ trunk/src/include/k5-platform.h 2011-06-10 18:17:12 UTC (rev 24959)
@@ -36,6 +36,7 @@
* + consistent getpwnam/getpwuid interfaces
* + va_copy fudged if not provided
* + [v]asprintf
+ * + _, N_, dgettext, bindtextdomain, setlocale (for localization)
*/
#ifndef K5_PLATFORM_H
@@ -1010,9 +1011,23 @@
extern void krb5int_zap(void *ptr, size_t len);
-/* Fudge for future adoption of gettext or the like. */
-#ifndef _
-#define _(X) (X)
+/*
+ * Localization macros. If we have gettext, define _ appropriately for
+ * translating a string. If we do not have gettext, define _, bindtextdomain,
+ * and setlocale as no-ops. N_ is always a no-op; it marks a string for
+ * extraction to pot files but does not translate it.
+ */
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#include <locale.h>
+#define KRB5_TEXTDOMAIN "mit-krb5"
+#define _(s) dgettext(KRB5_TEXTDOMAIN, s)
+#else
+#define _(s) s
+#define dgettext(d, m) m
+#define bindtextdomain(p, d)
+#define setlocale(c, l)
#endif
+#define N_(s) s
#endif /* K5_PLATFORM_H */
Modified: trunk/src/lib/krb5/Makefile.in
===================================================================
--- trunk/src/lib/krb5/Makefile.in 2011-06-10 15:45:13 UTC (rev 24958)
+++ trunk/src/lib/krb5/Makefile.in 2011-06-10 18:17:12 UTC (rev 24959)
@@ -3,7 +3,7 @@
LOCALINCLUDES = -I$(srcdir)/ccache -I$(srcdir)/keytab -I$(srcdir)/rcache -I$(srcdir)/os -I$(srcdir)/unicode
SUBDIRS= error_tables asn.1 ccache keytab krb os rcache unicode
WINSUBDIRS= $(SUBDIRS) posix
-DEFS=
+DEFS=-DLOCALEDIR=\"$(KRB5_LOCALEDIR)\"
##DOSBUILDTOP = ..\..
##DOSLIBNAME=$(OUTPRE)krb5.lib
Modified: trunk/src/lib/krb5/krb5_libinit.c
===================================================================
--- trunk/src/lib/krb5/krb5_libinit.c 2011-06-10 15:45:13 UTC (rev 24958)
+++ trunk/src/lib/krb5/krb5_libinit.c 2011-06-10 18:17:12 UTC (rev 24959)
@@ -41,6 +41,8 @@
add_error_table(&et_asn1_error_table);
add_error_table(&et_k524_error_table);
+ bindtextdomain(KRB5_TEXTDOMAIN, LOCALEDIR);
+
err = krb5int_rc_finish_init();
if (err)
return err;
Added: trunk/src/po/Makefile.in
===================================================================
--- trunk/src/po/Makefile.in (rev 0)
+++ trunk/src/po/Makefile.in 2011-06-10 18:17:12 UTC (rev 24959)
@@ -0,0 +1,33 @@
+mydir=po
+BUILDTOP=$(REL)..
+VER=@PACKAGE_VERSION@
+
+DOMAIN=mit-krb5
+POTFILE=$(srcdir)/$(DOMAIN).pot
+XGETTEXT=xgettext --foreign-user --package-name=mit-krb5 \
+ --package-version=$(VER) --copyright-holder=MIT
+# This is a placeholder until we have an actual translation.
+CATALOGS=en_US.mo
+
+.SUFFIXES: .po .mo
+.po.mo:
+ msgfmt -o $@ $<
+
+all:: $(CATALOGS)
+
+update-po: csrcs
+ $(XGETTEXT) -k_ -kN_ -o $(POTFILE) -f csrcs
+
+csrcs: always
+ find $(top_srcdir) -name "*.c" -print > $@
+
+always:
+
+install::
+ for c in $(CATALOGS); do \
+ lang=`basename $$c .mo`; \
+ $(top_srcdir)/config/mkinstalldirs \
+ $(DESTDIR)$(KRB5_LOCALEDIR)/$$lang/LC_MESSAGES; \
+ install -c $$c \
+ $(DESTDIR)$(KRB5_LOCALEDIR)/$$lang/LC_MESSAGES/$(DOMAIN).mo; \
+ done
Added: trunk/src/po/deps
===================================================================
--- trunk/src/po/deps (rev 0)
+++ trunk/src/po/deps 2011-06-10 18:17:12 UTC (rev 24959)
@@ -0,0 +1 @@
+# No dependencies here.
Added: trunk/src/po/en_US.po
===================================================================
--- trunk/src/po/en_US.po (rev 0)
+++ trunk/src/po/en_US.po 2011-06-10 18:17:12 UTC (rev 24959)
@@ -0,0 +1,17 @@
+# English translations for Kerberos 5 package.
+# Copyright (C) 2011 MIT
+# This file is distributed under the same license as the Kerberos 5 package.
+# Greg Hudson <ghudson at mit.edu>, 2011.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: mit-krb5 1.10-prerelease\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-06-06 00:34-0400\n"
+"PO-Revision-Date: 2011-06-06 00:35-0400\n"
+"Last-Translator: Greg Hudson <ghudson at mit.edu>\n"
+"Language-Team: English\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
Added: trunk/src/po/mit-krb5.pot
===================================================================
--- trunk/src/po/mit-krb5.pot (rev 0)
+++ trunk/src/po/mit-krb5.pot 2011-06-10 18:17:12 UTC (rev 24959)
@@ -0,0 +1,17 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR MIT
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: mit-krb5 1.10-prerelease\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2011-06-06 00:34-0400\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
More information about the cvs-krb5
mailing list