gettext codeset patch

From: Date: Thu, 08 Nov 2001 20:58:44 +0000
Subject: gettext codeset patch
Groups: php.dev 
Request: Send a blank email to php-dev+get-69832@lists.php.net to get a copy of this message
Hi,

attached is a little patch that adds function bind_textdomain_codeset(), which
allows you to set the output codeset of your translated strings. It doesn't
break backwards compatibility with older releases of gettext.

Hopefully someone will test & commit this.

--

Rudi


Index: gettext.c =================================================================== RCS file: /repository/php4/ext/gettext/gettext.c,v retrieving revision 1.35 diff -u -u -r1.35 gettext.c --- gettext.c 11 Oct 2001 23:32:50 -0000 1.35 +++ gettext.c 8 Nov 2001 20:50:23 -0000 @@ -49,6 +49,11 @@ #if HAVE_DCNGETTEXT PHP_FE(dcngettext, NULL) #endif +#if HAVE_BIND_TEXTDOMAIN_CODESET + PHP_FE(bind_textdomain_codeset, NULL) +#endif + + {NULL, NULL, NULL} }; /* }}} */ @@ -268,6 +273,30 @@ } /* }}} */ #endif + +#if HAVE_BIND_TEXTDOMAIN_CODESET + +/* {{{ proto string bind_textdomain_codeset (string domain, string codeset) + Specify the character encoding in which the messages from the DOMAIN message catalog will be returned. */ +PHP_FUNCTION(bind_textdomain_codeset) +{ + zval **domain, **codeset; + char *retval; + + if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &domain, &codeset) == FAILURE) { + WRONG_PARAM_COUNT; + } else { + convert_to_string_ex(domain); + convert_to_string_ex(codeset); + + retval = bind_textdomain_codeset(Z_STRVAL_PP(domain), Z_STRVAL_PP(codeset)); + + RETURN_STRING(retval, 1); + } +} +/* }}} */ +#endif + #endif /* HAVE_LIBINTL */ Index: config.m4 =================================================================== RCS file: /repository/php4/ext/gettext/config.m4,v retrieving revision 1.8 diff -u -u -r1.8 config.m4 --- config.m4 29 Aug 2001 13:13:24 -0000 1.8 +++ config.m4 8 Nov 2001 20:50:23 -0000 @@ -48,5 +48,6 @@ AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, ngettext, [AC_DEFINE(HAVE_NGETTEXT, 1, [ ])]) AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, dngettext, [AC_DEFINE(HAVE_DNGETTEXT, 1, [ ])]) AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, dcngettext, [AC_DEFINE(HAVE_DCNGETTEXT, 1, [ ])]) + AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB, bind_textdomain_codeset, [AC_DEFINE(HAVE_BIND_TEXTDOMAIN_CODESET, 1, [ ])]) fi Index: php_gettext.h =================================================================== RCS file: /repository/php4/ext/gettext/php_gettext.h,v retrieving revision 1.13 diff -u -u -r1.13 php_gettext.h --- php_gettext.h 29 Aug 2001 13:13:24 -0000 1.13 +++ php_gettext.h 8 Nov 2001 20:50:23 -0000 @@ -45,6 +45,9 @@ #if HAVE_DCNGETTEXT PHP_FUNCTION(dcngettext); #endif +#if HAVE_BIND_TEXTDOMAIN_CODESET +PHP_FUNCTION(bind_textdomain_codeset); +#endif #else #define gettext_module_ptr NULL

Thread (2 messages)

« previous php.dev (#69832) next »