1999-04-21 17:26:16 +00:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
2004-01-08 08:18:22 +00:00
|
|
|
| PHP Version 5 |
|
1999-04-21 17:26:16 +00:00
|
|
|
+----------------------------------------------------------------------+
|
2006-01-01 12:51:34 +00:00
|
|
|
| Copyright (c) 1997-2006 The PHP Group |
|
1999-04-21 17:26:16 +00:00
|
|
|
+----------------------------------------------------------------------+
|
2006-01-01 12:51:34 +00:00
|
|
|
| This source file is subject to version 3.01 of the PHP license, |
|
1999-07-16 13:13:16 +00:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
2003-06-10 20:04:29 +00:00
|
|
|
| available through the world-wide-web at the following url: |
|
2006-01-01 12:51:34 +00:00
|
|
|
| http://www.php.net/license/3_01.txt |
|
1999-07-16 13:13:16 +00:00
|
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@php.net so we can mail you a copy immediately. |
|
1999-04-21 17:26:16 +00:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Author: Alex Plotnick <alex@wgate.com> |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
2001-05-24 10:07:29 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
1999-04-21 17:26:16 +00:00
|
|
|
#include "php.h"
|
|
|
|
|
|
|
|
#if HAVE_LIBINTL
|
|
|
|
|
2003-09-24 02:07:04 +00:00
|
|
|
#include <stdio.h>
|
2000-04-05 22:30:19 +00:00
|
|
|
#include "ext/standard/info.h"
|
2003-09-24 02:07:04 +00:00
|
|
|
#include "php_gettext.h"
|
1999-04-21 17:26:16 +00:00
|
|
|
|
2006-06-14 21:36:10 +00:00
|
|
|
/* {{{ arginfo */
|
|
|
|
static
|
|
|
|
ZEND_BEGIN_ARG_INFO(arginfo_textdomain, 0)
|
|
|
|
ZEND_ARG_INFO(0, domain)
|
|
|
|
ZEND_END_ARG_INFO()
|
|
|
|
|
|
|
|
static
|
|
|
|
ZEND_BEGIN_ARG_INFO(arginfo_gettext, 0)
|
|
|
|
ZEND_ARG_INFO(0, msgid)
|
|
|
|
ZEND_END_ARG_INFO()
|
|
|
|
|
|
|
|
static
|
|
|
|
ZEND_BEGIN_ARG_INFO(arginfo_dgettext, 0)
|
|
|
|
ZEND_ARG_INFO(0, domain_name)
|
|
|
|
ZEND_ARG_INFO(0, msgid)
|
|
|
|
ZEND_END_ARG_INFO()
|
|
|
|
|
|
|
|
static
|
|
|
|
ZEND_BEGIN_ARG_INFO(arginfo_dcgettext, 0)
|
|
|
|
ZEND_ARG_INFO(0, domain_name)
|
|
|
|
ZEND_ARG_INFO(0, msgid)
|
|
|
|
ZEND_ARG_INFO(0, category)
|
|
|
|
ZEND_END_ARG_INFO()
|
|
|
|
|
|
|
|
static
|
|
|
|
ZEND_BEGIN_ARG_INFO(arginfo_bindtextdomain, 0)
|
|
|
|
ZEND_ARG_INFO(0, domain_name)
|
|
|
|
ZEND_ARG_INFO(0, dir)
|
|
|
|
ZEND_END_ARG_INFO()
|
|
|
|
|
|
|
|
#if HAVE_NGETTEXT
|
|
|
|
static
|
|
|
|
ZEND_BEGIN_ARG_INFO(arginfo_ngettext, 0)
|
|
|
|
ZEND_ARG_INFO(0, msgid1)
|
|
|
|
ZEND_ARG_INFO(0, msgid2)
|
|
|
|
ZEND_ARG_INFO(0, count)
|
|
|
|
ZEND_END_ARG_INFO()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAVE_DNGETTEXT
|
|
|
|
static
|
|
|
|
ZEND_BEGIN_ARG_INFO(arginfo_dngettext, 0)
|
|
|
|
ZEND_ARG_INFO(0, domain)
|
|
|
|
ZEND_ARG_INFO(0, msgid1)
|
|
|
|
ZEND_ARG_INFO(0, msgid2)
|
|
|
|
ZEND_ARG_INFO(0, count)
|
|
|
|
ZEND_END_ARG_INFO()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAVE_DCNGETTEXT
|
|
|
|
static
|
|
|
|
ZEND_BEGIN_ARG_INFO(arginfo_dcngettext, 0)
|
|
|
|
ZEND_ARG_INFO(0, domain)
|
|
|
|
ZEND_ARG_INFO(0, msgid1)
|
|
|
|
ZEND_ARG_INFO(0, msgid2)
|
|
|
|
ZEND_ARG_INFO(0, count)
|
|
|
|
ZEND_ARG_INFO(0, category)
|
|
|
|
ZEND_END_ARG_INFO()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAVE_BIND_TEXTDOMAIN_CODESET
|
|
|
|
static
|
|
|
|
ZEND_BEGIN_ARG_INFO(arginfo_bind_textdomain_codeset, 0)
|
|
|
|
ZEND_ARG_INFO(0, domain)
|
|
|
|
ZEND_ARG_INFO(0, codeset)
|
|
|
|
ZEND_END_ARG_INFO()
|
|
|
|
#endif
|
|
|
|
/* }}} */
|
|
|
|
|
2001-06-06 13:06:12 +00:00
|
|
|
/* {{{ php_gettext_functions[]
|
|
|
|
*/
|
2005-12-06 02:28:41 +00:00
|
|
|
zend_function_entry php_gettext_functions[] = {
|
2006-06-14 21:36:10 +00:00
|
|
|
PHP_NAMED_FE(textdomain, zif_textdomain, arginfo_textdomain)
|
|
|
|
PHP_NAMED_FE(gettext, zif_gettext, arginfo_gettext)
|
2003-09-24 02:07:04 +00:00
|
|
|
/* Alias for gettext() */
|
2006-06-14 21:36:10 +00:00
|
|
|
PHP_NAMED_FE(_, zif_gettext, arginfo_gettext)
|
|
|
|
PHP_NAMED_FE(dgettext, zif_dgettext, arginfo_dgettext)
|
|
|
|
PHP_NAMED_FE(dcgettext, zif_dcgettext, arginfo_dcgettext)
|
|
|
|
PHP_NAMED_FE(bindtextdomain, zif_bindtextdomain, arginfo_bindtextdomain)
|
2001-08-29 13:13:24 +00:00
|
|
|
#if HAVE_NGETTEXT
|
2006-06-14 21:36:10 +00:00
|
|
|
PHP_NAMED_FE(ngettext, zif_ngettext, arginfo_ngettext)
|
2001-08-29 13:13:24 +00:00
|
|
|
#endif
|
|
|
|
#if HAVE_DNGETTEXT
|
2006-06-14 21:36:10 +00:00
|
|
|
PHP_NAMED_FE(dngettext, zif_dngettext, arginfo_dngettext)
|
2001-08-29 13:13:24 +00:00
|
|
|
#endif
|
|
|
|
#if HAVE_DCNGETTEXT
|
2006-06-14 21:36:10 +00:00
|
|
|
PHP_NAMED_FE(dcngettext, zif_dcngettext, arginfo_dcngettext)
|
2001-08-29 13:13:24 +00:00
|
|
|
#endif
|
2001-11-09 16:27:09 +00:00
|
|
|
#if HAVE_BIND_TEXTDOMAIN_CODESET
|
2006-06-14 21:36:10 +00:00
|
|
|
PHP_NAMED_FE(bind_textdomain_codeset, zif_bind_textdomain_codeset, arginfo_bind_textdomain_codeset)
|
2001-11-09 16:27:09 +00:00
|
|
|
#endif
|
1999-04-21 17:26:16 +00:00
|
|
|
{NULL, NULL, NULL}
|
|
|
|
};
|
2001-06-06 13:06:12 +00:00
|
|
|
/* }}} */
|
1999-04-21 17:26:16 +00:00
|
|
|
|
2004-07-29 22:23:23 +00:00
|
|
|
#include <libintl.h>
|
|
|
|
|
1999-12-17 21:50:07 +00:00
|
|
|
zend_module_entry php_gettext_module_entry = {
|
2003-09-24 02:07:04 +00:00
|
|
|
STANDARD_MODULE_HEADER,
|
2001-08-27 22:26:49 +00:00
|
|
|
"gettext",
|
|
|
|
php_gettext_functions,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2003-09-24 02:07:04 +00:00
|
|
|
PHP_MINFO(php_gettext),
|
|
|
|
NO_VERSION_YET,
|
2001-08-27 22:26:49 +00:00
|
|
|
STANDARD_MODULE_PROPERTIES
|
1999-04-21 17:26:16 +00:00
|
|
|
};
|
|
|
|
|
2000-05-23 22:26:51 +00:00
|
|
|
#ifdef COMPILE_DL_GETTEXT
|
|
|
|
ZEND_GET_MODULE(php_gettext)
|
|
|
|
#endif
|
|
|
|
|
2003-09-24 02:07:04 +00:00
|
|
|
PHP_MINFO_FUNCTION(php_gettext)
|
1999-04-21 17:26:16 +00:00
|
|
|
{
|
2000-04-05 22:30:19 +00:00
|
|
|
php_info_print_table_start();
|
2001-06-09 16:55:27 +00:00
|
|
|
php_info_print_table_row(2, "GetText Support", "enabled");
|
2000-04-05 22:30:19 +00:00
|
|
|
php_info_print_table_end();
|
1999-04-21 17:26:16 +00:00
|
|
|
}
|
|
|
|
|
2000-03-19 23:39:05 +00:00
|
|
|
/* {{{ proto string textdomain(string domain)
|
2000-08-08 20:28:19 +00:00
|
|
|
Set the textdomain to "domain". Returns the current domain */
|
2003-09-24 02:07:04 +00:00
|
|
|
PHP_NAMED_FUNCTION(zif_textdomain)
|
1999-04-21 17:26:16 +00:00
|
|
|
{
|
2001-08-27 18:43:07 +00:00
|
|
|
zval **domain;
|
2000-12-08 16:25:38 +00:00
|
|
|
char *domain_name, *retval;
|
1999-09-24 19:15:17 +00:00
|
|
|
char *val;
|
1999-04-21 17:26:16 +00:00
|
|
|
|
2000-12-08 16:25:38 +00:00
|
|
|
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &domain) == FAILURE) {
|
1999-04-21 17:26:16 +00:00
|
|
|
WRONG_PARAM_COUNT;
|
2000-12-08 16:25:38 +00:00
|
|
|
}
|
|
|
|
convert_to_string_ex(domain);
|
1999-04-21 17:26:16 +00:00
|
|
|
|
2001-08-27 18:43:07 +00:00
|
|
|
val = Z_STRVAL_PP(domain);
|
1999-09-24 19:15:17 +00:00
|
|
|
if (strcmp(val, "") && strcmp(val, "0")) {
|
|
|
|
domain_name = val;
|
1999-04-21 17:26:16 +00:00
|
|
|
} else {
|
|
|
|
domain_name = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
retval = textdomain(domain_name);
|
|
|
|
|
2000-12-08 16:25:38 +00:00
|
|
|
RETURN_STRING(retval, 1);
|
1999-04-21 17:26:16 +00:00
|
|
|
}
|
2000-03-19 23:39:05 +00:00
|
|
|
/* }}} */
|
1999-04-21 17:26:16 +00:00
|
|
|
|
2000-03-19 23:39:05 +00:00
|
|
|
/* {{{ proto string gettext(string msgid)
|
2000-08-08 20:28:19 +00:00
|
|
|
Return the translation of msgid for the current domain, or msgid unaltered if a translation does not exist */
|
2003-09-24 02:07:04 +00:00
|
|
|
PHP_NAMED_FUNCTION(zif_gettext)
|
1999-04-21 17:26:16 +00:00
|
|
|
{
|
2001-08-27 18:43:07 +00:00
|
|
|
zval **msgid;
|
2000-12-08 16:25:38 +00:00
|
|
|
char *msgstr;
|
1999-04-21 17:26:16 +00:00
|
|
|
|
2000-12-08 16:25:38 +00:00
|
|
|
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &msgid) == FAILURE) {
|
1999-04-21 17:26:16 +00:00
|
|
|
WRONG_PARAM_COUNT;
|
2000-12-08 16:25:38 +00:00
|
|
|
}
|
|
|
|
convert_to_string_ex(msgid);
|
1999-04-21 17:26:16 +00:00
|
|
|
|
2001-08-27 18:43:07 +00:00
|
|
|
msgstr = gettext(Z_STRVAL_PP(msgid));
|
1999-04-21 17:26:16 +00:00
|
|
|
|
2000-12-08 16:25:38 +00:00
|
|
|
RETURN_STRING(msgstr, 1);
|
1999-04-21 17:26:16 +00:00
|
|
|
}
|
2000-03-19 23:39:05 +00:00
|
|
|
/* }}} */
|
1999-04-21 17:26:16 +00:00
|
|
|
|
2000-03-19 23:39:05 +00:00
|
|
|
/* {{{ proto string dgettext(string domain_name, string msgid)
|
2000-08-08 20:28:19 +00:00
|
|
|
Return the translation of msgid for domain_name, or msgid unaltered if a translation does not exist */
|
2003-09-24 02:07:04 +00:00
|
|
|
PHP_NAMED_FUNCTION(zif_dgettext)
|
1999-04-21 17:26:16 +00:00
|
|
|
{
|
2001-08-27 18:43:07 +00:00
|
|
|
zval **domain_name, **msgid;
|
1999-04-21 17:26:16 +00:00
|
|
|
char *msgstr;
|
|
|
|
|
2000-12-08 16:25:38 +00:00
|
|
|
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &domain_name, &msgid) == FAILURE) {
|
1999-04-21 17:26:16 +00:00
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
}
|
1999-09-24 19:15:17 +00:00
|
|
|
convert_to_string_ex(domain_name);
|
|
|
|
convert_to_string_ex(msgid);
|
1999-04-21 17:26:16 +00:00
|
|
|
|
2001-08-27 18:43:07 +00:00
|
|
|
msgstr = dgettext(Z_STRVAL_PP(domain_name), Z_STRVAL_PP(msgid));
|
1999-04-21 17:26:16 +00:00
|
|
|
|
|
|
|
RETURN_STRING(msgstr, 1);
|
|
|
|
}
|
2000-03-19 23:39:05 +00:00
|
|
|
/* }}} */
|
1999-04-21 17:26:16 +00:00
|
|
|
|
2000-03-19 23:39:05 +00:00
|
|
|
/* {{{ proto string dcgettext(string domain_name, string msgid, long category)
|
2000-08-08 20:28:19 +00:00
|
|
|
Return the translation of msgid for domain_name and category, or msgid unaltered if a translation does not exist */
|
2003-09-24 02:07:04 +00:00
|
|
|
PHP_NAMED_FUNCTION(zif_dcgettext)
|
1999-04-21 17:26:16 +00:00
|
|
|
{
|
2001-08-27 18:43:07 +00:00
|
|
|
zval **domain_name, **msgid, **category;
|
1999-04-21 17:26:16 +00:00
|
|
|
char *msgstr;
|
|
|
|
|
2000-12-08 16:25:38 +00:00
|
|
|
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &domain_name, &msgid, &category) == FAILURE) {
|
1999-04-21 17:26:16 +00:00
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
}
|
1999-09-24 19:15:17 +00:00
|
|
|
convert_to_string_ex(domain_name);
|
|
|
|
convert_to_string_ex(msgid);
|
|
|
|
convert_to_long_ex(category);
|
1999-04-21 17:26:16 +00:00
|
|
|
|
2001-08-27 22:26:49 +00:00
|
|
|
msgstr = dcgettext(Z_STRVAL_PP(domain_name), Z_STRVAL_PP(msgid), Z_LVAL_PP(category));
|
1999-04-21 17:26:16 +00:00
|
|
|
|
|
|
|
RETURN_STRING(msgstr, 1);
|
|
|
|
}
|
2000-03-19 23:39:05 +00:00
|
|
|
/* }}} */
|
1999-04-21 17:26:16 +00:00
|
|
|
|
2000-03-19 23:39:05 +00:00
|
|
|
/* {{{ proto string bindtextdomain(string domain_name, string dir)
|
2000-08-08 20:28:19 +00:00
|
|
|
Bind to the text domain domain_name, looking for translations in dir. Returns the current domain */
|
2003-09-24 02:07:04 +00:00
|
|
|
PHP_NAMED_FUNCTION(zif_bindtextdomain)
|
1999-04-21 17:26:16 +00:00
|
|
|
{
|
2001-08-27 18:43:07 +00:00
|
|
|
zval **domain_name, **dir;
|
2000-11-27 18:21:48 +00:00
|
|
|
char *retval, dir_name[MAXPATHLEN];
|
1999-04-21 17:26:16 +00:00
|
|
|
|
2000-12-08 16:25:38 +00:00
|
|
|
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &domain_name, &dir) == FAILURE) {
|
1999-04-21 17:26:16 +00:00
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
}
|
1999-09-24 19:15:17 +00:00
|
|
|
convert_to_string_ex(domain_name);
|
|
|
|
convert_to_string_ex(dir);
|
1999-04-21 17:26:16 +00:00
|
|
|
|
2003-02-08 18:58:34 +00:00
|
|
|
if (Z_STRVAL_PP(domain_name)[0] == '\0') {
|
|
|
|
php_error(E_WARNING, "The first parameter of bindtextdomain must not be empty");
|
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Z_STRVAL_PP(dir)[0] != '\0' && strcmp(Z_STRVAL_PP(dir), "0")) {
|
2001-08-27 18:43:07 +00:00
|
|
|
VCWD_REALPATH(Z_STRVAL_PP(dir), dir_name);
|
1999-04-21 17:26:16 +00:00
|
|
|
} else {
|
2001-04-30 12:45:02 +00:00
|
|
|
VCWD_GETCWD(dir_name, MAXPATHLEN);
|
1999-04-21 17:26:16 +00:00
|
|
|
}
|
|
|
|
|
2001-08-27 18:43:07 +00:00
|
|
|
retval = bindtextdomain(Z_STRVAL_PP(domain_name), dir_name);
|
1999-04-21 17:26:16 +00:00
|
|
|
|
|
|
|
RETURN_STRING(retval, 1);
|
|
|
|
}
|
2000-03-19 23:39:05 +00:00
|
|
|
/* }}} */
|
1999-04-21 17:26:16 +00:00
|
|
|
|
2001-08-29 13:13:24 +00:00
|
|
|
#if HAVE_NGETTEXT
|
2001-08-27 18:43:07 +00:00
|
|
|
/* {{{ proto string ngettext(string MSGID1, string MSGID2, int N)
|
2001-08-27 22:26:49 +00:00
|
|
|
Plural version of gettext() */
|
2003-09-24 02:07:04 +00:00
|
|
|
PHP_NAMED_FUNCTION(zif_ngettext)
|
2001-08-27 18:43:07 +00:00
|
|
|
{
|
|
|
|
zval **msgid1, **msgid2, **count;
|
|
|
|
char *msgstr;
|
|
|
|
|
|
|
|
RETVAL_FALSE;
|
|
|
|
|
2001-08-27 22:26:49 +00:00
|
|
|
if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &msgid1, &msgid2, &count) == FAILURE) {
|
2001-08-27 18:43:07 +00:00
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
} else {
|
|
|
|
convert_to_string_ex(msgid1);
|
|
|
|
convert_to_string_ex(msgid2);
|
|
|
|
convert_to_long_ex(count);
|
|
|
|
|
2001-08-27 22:26:49 +00:00
|
|
|
msgstr = ngettext(Z_STRVAL_PP(msgid1), Z_STRVAL_PP(msgid2), Z_LVAL_PP(count));
|
2001-08-27 18:43:07 +00:00
|
|
|
if (msgstr) {
|
|
|
|
RETVAL_STRING (msgstr, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* }}} */
|
2001-08-29 13:13:24 +00:00
|
|
|
#endif
|
2001-08-27 18:43:07 +00:00
|
|
|
|
2001-08-29 13:13:24 +00:00
|
|
|
#if HAVE_DNGETTEXT
|
2001-12-15 14:22:59 +00:00
|
|
|
/* {{{ proto string dngettext (string domain, string msgid1, string msgid2, int count)
|
2001-08-27 22:26:49 +00:00
|
|
|
Plural version of dgettext() */
|
2003-09-24 02:07:04 +00:00
|
|
|
PHP_NAMED_FUNCTION(zif_dngettext)
|
2001-08-27 18:43:07 +00:00
|
|
|
{
|
|
|
|
zval **domain, **msgid1, **msgid2, **count;
|
|
|
|
|
|
|
|
RETVAL_FALSE;
|
|
|
|
|
2001-08-27 22:26:49 +00:00
|
|
|
if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &domain, &msgid1, &msgid2, &count) == FAILURE) {
|
2001-08-27 18:43:07 +00:00
|
|
|
WRONG_PARAM_COUNT;
|
|
|
|
} else {
|
|
|
|
char *msgstr;
|
|
|
|
|
|
|
|
convert_to_string_ex(domain);
|
|
|
|
convert_to_string_ex(msgid1);
|
|
|
|
convert_to_string_ex(msgid2);
|
|
|
|
convert_to_long_ex(count);
|
|
|
|
|
2001-08-27 22:26:49 +00:00
|
|
|
msgstr = dngettext(Z_STRVAL_PP(domain), Z_STRVAL_PP(msgid1), Z_STRVAL_PP(msgid2), Z_LVAL_PP(count));
|
2001-08-27 18:43:07 +00:00
|
|
|
if (msgstr) {
|
|
|
|
RETVAL_STRING(msgstr, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* }}} */
|
2001-08-29 13:13:24 +00:00
|
|
|
#endif
|
2001-08-27 18:43:07 +00:00
|
|
|
|
2001-08-29 13:13:24 +00:00
|
|
|
#if HAVE_DCNGETTEXT
|
2001-12-15 14:22:59 +00:00
|
|
|
/* {{{ proto string dcngettext (string domain, string msgid1, string msgid2, int n, int category)
|
2001-08-27 22:26:49 +00:00
|
|
|
Plural version of dcgettext() */
|
2003-09-24 02:07:04 +00:00
|
|
|
PHP_NAMED_FUNCTION(zif_dcngettext)
|
2001-08-27 18:43:07 +00:00
|
|
|
{
|
|
|
|
zval **domain, **msgid1, **msgid2, **count, **category;
|
|
|
|
|
|
|
|
RETVAL_FALSE;
|
|
|
|
|
2001-08-27 22:26:49 +00:00
|
|
|
if (ZEND_NUM_ARGS() != 5 || zend_get_parameters_ex(4, &domain, &msgid1, &msgid2, &count, &category) == FAILURE) {
|
|
|
|
WRONG_PARAM_COUNT;
|
2001-08-27 18:43:07 +00:00
|
|
|
} else {
|
|
|
|
char* msgstr = NULL;
|
|
|
|
|
|
|
|
convert_to_string_ex(domain);
|
|
|
|
convert_to_string_ex(msgid1);
|
|
|
|
convert_to_string_ex(msgid2);
|
|
|
|
convert_to_long_ex(count);
|
|
|
|
convert_to_long_ex(category);
|
|
|
|
|
2001-08-27 22:26:49 +00:00
|
|
|
msgstr = dcngettext(Z_STRVAL_PP(domain), Z_STRVAL_PP(msgid1), Z_STRVAL_PP(msgid2), Z_LVAL_PP(count), Z_LVAL_PP(category));
|
2001-08-27 18:43:07 +00:00
|
|
|
|
|
|
|
if (msgstr) {
|
|
|
|
RETVAL_STRING(msgstr, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-08-29 13:13:24 +00:00
|
|
|
/* }}} */
|
|
|
|
#endif
|
2001-08-27 18:43:07 +00:00
|
|
|
|
2001-11-09 16:27:09 +00:00
|
|
|
#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. */
|
2003-09-24 02:07:04 +00:00
|
|
|
PHP_NAMED_FUNCTION(zif_bind_textdomain_codeset)
|
2001-11-09 16:27:09 +00:00
|
|
|
{
|
|
|
|
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));
|
|
|
|
|
2002-08-07 11:50:49 +00:00
|
|
|
if (!retval) {
|
|
|
|
RETURN_FALSE;
|
|
|
|
}
|
2001-11-09 16:27:09 +00:00
|
|
|
RETURN_STRING(retval, 1);
|
2002-08-07 11:50:49 +00:00
|
|
|
}
|
2001-11-09 16:27:09 +00:00
|
|
|
}
|
|
|
|
/* }}} */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
1999-04-21 17:26:16 +00:00
|
|
|
#endif /* HAVE_LIBINTL */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* End:
|
2001-09-09 13:29:31 +00:00
|
|
|
* vim600: sw=4 ts=4 fdm=marker
|
|
|
|
* vim<600: sw=4 ts=4
|
1999-04-21 17:26:16 +00:00
|
|
|
*/
|
2001-08-29 13:13:24 +00:00
|
|
|
|