diff options
author | joe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845> | 2005-08-29 16:29:05 +0000 |
---|---|---|
committer | joe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845> | 2005-08-29 16:29:05 +0000 |
commit | 28a605a142dc9fcd6f7490121c75c4b855c38de2 (patch) | |
tree | 23806794b24c5ce34318a3cedf726e41c0efe21e | |
parent | ef3565de9526bf9b23097b820a21d9893c87861a (diff) | |
download | neon-28a605a142dc9fcd6f7490121c75c4b855c38de2.tar.gz |
* src/ne_i18n.h (ne_i18n_init): Take an encoding parameter.
* src/ne_i18n.c (ne_i18n_init) [HAVE_BIND_TEXTDOMAIN_CODESET]: Call
bind_textdomain_codeset if encoding is specified.
* macros/neon.m4 (NEON_I18N): Fix to enable NLS by default. Check for
bind_textdomain_codeset.
* test/common/tests.c (main): Pass NULL to ne_i18n_init.
git-svn-id: http://svn.webdav.org/repos/projects/neon/trunk@691 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845
-rw-r--r-- | macros/neon.m4 | 3 | ||||
-rw-r--r-- | src/ne_i18n.c | 9 | ||||
-rw-r--r-- | src/ne_i18n.h | 8 | ||||
-rw-r--r-- | test/common/tests.c | 2 |
4 files changed, 17 insertions, 5 deletions
diff --git a/macros/neon.m4 b/macros/neon.m4 index 6c90f25..16600d3 100644 --- a/macros/neon.m4 +++ b/macros/neon.m4 @@ -1041,7 +1041,7 @@ esac])]) AC_DEFUN([NEON_I18N], [ AC_ARG_ENABLE(nls, - AS_HELP_STRING(--disable-nls, [disable internationalization support]),,, + AS_HELP_STRING(--disable-nls, [disable internationalization support]),, [enable_nls=yes]) if test "x${enable_nls}${ac_cv_header_libintl_h}" = "xyesyes"; then @@ -1049,6 +1049,7 @@ if test "x${enable_nls}${ac_cv_header_libintl_h}" = "xyesyes"; then # checking for dgettext() itself is awkward because gcc has a # builtin of that function, which confuses AC_CHECK_FUNCS et al. NE_SEARCH_LIBS(bindtextdomain, intl,,[enable_nls=no]) + NE_CHECK_FUNCS(bind_textdomain_codeset) fi if test "$enable_nls" = "no"; then diff --git a/src/ne_i18n.c b/src/ne_i18n.c index 608bed2..0fb4a3b 100644 --- a/src/ne_i18n.c +++ b/src/ne_i18n.c @@ -27,7 +27,7 @@ #include <libintl.h> #endif -void ne_i18n_init(void) +void ne_i18n_init(const char *encoding) { #if defined(NE_HAVE_I18N) && defined(NEON_IS_LIBRARY) /* The bindtextdomain call is only enabled if neon is built as a @@ -36,5 +36,12 @@ void ne_i18n_init(void) * message catalogs could be installed alongside the app's own * message catalogs. */ bindtextdomain("neon", LOCALEDIR); + +#ifdef HAVE_BIND_TEXTDOMAIN_CODESET + if (encoding) { + bind_textdomain_codeset("neon", encoding); + } +#endif /* HAVE_BIND_TEXTDOMAIN_CODESET */ + #endif } diff --git a/src/ne_i18n.h b/src/ne_i18n.h index e1d8469..b099816 100644 --- a/src/ne_i18n.h +++ b/src/ne_i18n.h @@ -28,7 +28,11 @@ * on which it depends for i18n purposes. If this call is not made, * the message catalogs will not be found in that case, but the * library will operate otherwise correctly (albeit giving - * English-only error messages). */ -void ne_i18n_init(void); + * English-only error messages). + * + * If 'encoding' is non-NULL, it specifies the character encoding for + * the generated translated strings. If it is NULL, the appropriate + * character encoding for the locale will be used. */ +void ne_i18n_init(const char *encoding); #endif /* NE_I18N_H */ diff --git a/test/common/tests.c b/test/common/tests.c index 31d3644..dc2e574 100644 --- a/test/common/tests.c +++ b/test/common/tests.c @@ -159,7 +159,7 @@ int main(int argc, char *argv[]) setlocale(LC_MESSAGES, ""); #endif - ne_i18n_init(); + ne_i18n_init(NULL); #if defined(HAVE_ISATTY) && defined(STDOUT_FILENO) if (isatty(STDOUT_FILENO)) { |