ID: 41391
Updated by: [EMAIL PROTECTED]
Reported By: pprocacci at datapipe dot com
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
Operating System: FreeBSD 6.2
PHP Version: 5.2.2
New Comment:
There are lots of user notes discussing this very problem on different
operating systems.
Previous Comments:
------------------------------------------------------------------------
[2007-05-15 16:06:17] pprocacci at datapipe dot com
Hi,
This has been resolved by making the following changes.
putenv("LANG=$language");
$locale = setlocale(LC_ALL, "");
//$locale = setlocale(LC_ALL, $language);
Would you consider this to be a documetation bug of some kind?
Anyways, thanks for the help.
------------------------------------------------------------------------
[2007-05-15 14:44:16] pprocacci at datapipe dot com
nat# echo $LANG
LANG: Undefined variable.
nat# echo $LANGUAGE
LANGUAGE: Undefined variable.
They aren't defined.
------------------------------------------------------------------------
[2007-05-15 11:18:04] [EMAIL PROTECTED]
Be sure to (un) set LANG and LANGUAGE environment variables.
------------------------------------------------------------------------
[2007-05-15 00:47:43] pprocacci at datapipe dot com
Description:
------------
Translation of strings are not working. A 'truss' of the process shows
a `stat` of the locale directory that I want (i.e. /DOCROOT/locale) when
calling bindtextdomain, but no further files/directories in that root
are ever opened for reading to further process the calls that I am
making, hence this bug report. Truss/strace available upon request.
Example Locale Dir:
-------------------
$ ls -l /DOCROOT/locale/zh_CN/LC_MESSAGES/messages.{mo,po}
-rwxrwxrwx 1 user group 5729 May 9 19:51
/DOCROOT/locale/zh_CN/LC_MESSAGES/messages.mo*
-rwxrwxrwx 1 user group 110013 May 9 19:51
/DOCROOT/locale/zh_CN/LC_MESSAGES/messages.po*
Operating System:
------------------------------
$ uname -a
FreeBSD mysite.com 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Mon Jan 15
03:47:08 UTC 2007
[EMAIL PROTECTED]:/usr/obj/usr/src/sys/SMP i386
Installed Extensions:
---------------------------------------
$ pkg_info | fgrep php5
php5-5.2.1_3
php5-bz2-5.2.1_3
php5-ctype-5.2.1_3
php5-dom-5.2.1_3
php5-ftp-5.2.1_3
php5-gd-5.2.1_3
php5-gettext-5.2.1_3
php5-iconv-5.2.1_3
php5-mbstring-5.2.1_3
php5-mcrypt-5.2.1_3
php5-mysql-5.2.1_3
php5-openssl-5.2.1_3
php5-pcre-5.2.1_5
php5-pdo-5.2.1_3
php5-pdo_sqlite-5.2.1_3
php5-posix-5.2.1_3
php5-session-5.2.1_3
php5-simplexml-5.2.1_3
php5-spl-5.2.1_3
php5-sqlite-5.2.1_3
php5-tokenizer-5.2.1_3
php5-xml-5.2.1_3
php5-xmlreader-5.2.1_3
php5-xmlwriter-5.2.1_3
php5-zlib-5.2.1_3
Reproduce code:
---------------
<?php
setlocale(LC_MESSAGES, 'zh_CN.UTF-8');
textdomain("messages");
bindtextdomain("messages", "/DOCROOT/locale");
echo _("Hello");
?>
Expected result:
----------------
Weird non-English Characters.
Actual result:
--------------
A string that was passed to the function.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41391&edit=1