|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-05-15 00:47 UTC] 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 root@jumpstart.teb.yep.net:/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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 19:00:01 2025 UTC |
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.