Adding LC_* constants to PHP?
| From: | Zak Greant | Date: | Mon, 04 Dec 2000 08:03:07 +0000 |
| Subject: | Adding LC_* constants to PHP? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-39933@lists.php.net to get a copy of this message | ||
I would like to add a set of constants for the LC_* values to the gettext.c
file. Doing this would allow people using the dcgettext function (all one
or two of us ;) to use a constant, instead of a numeric value for the
category argument of the function.
Can anyone see a down side to doing this?
As I understand it, I would need to add the following code to gettext.c:
PHP_MINIT_FUNCTION(gettext)
{
REGISTER_LONG_CONSTANT("LC_CTYPE", LC_CTYPE, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LC_NUMERIC", LC_NUMERIC, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LC_TIME", LC_TIME, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LC_COLLATE", LC_COLLATE, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LC_MONETARY", LC_MONETARY, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LC_MESSAGES", LC_MESSAGES, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("LC_ALL", LC_ALL, CONST_CS | CONST_PERSISTENT);
return SUCCESS; // I am not sure if this is needed...
}
The LC_* constants used to set the values for the analogous PHP constants
should already be available from locale.h (which is included by libintl.h)
Any comments or suggestions?
--zak