Edit report at http://bugs.php.net/bug.php?id=43570&edit=1
ID: 43570 Comment by: clicky at erebot dot net Reported by: foo at snarf dot de Summary: reason for some gettext errors found, need fix in interface Status: Open Type: Feature/Change Request Package: Feature/Change Request Operating System: Debian etch 2.6.18-5-xen-amd64 PHP Version: 5.2.5 Block user comment: N Private report: N New Comment: Sorry for digging up an old bug report. I'm merely posting this for others having the same problem you described. To circumvent this, you may use this PEAR package: http://pear.php.net/package/File_Gettext It provides a simple interface to load/edit/save gettext-compatible .po & .mo files. There's also a "php-gettext" package in some Unix distributions which can also be used as an alternative to PHP's gettext extension. Both of these are independent from the system's gettext library and therefore, don't have the bug you described. Previous Comments: ------------------------------------------------------------------------ [2007-12-11 20:43:41] foo at snarf dot de Description: ------------ gettext works fine on one server, the precisely same source and .mo-Files fail to work on another (same OS, same PHP versions). Reproduce code: --------------- See some minimal gettext sample code on the web like the one below, it happens with all, really. <?php setlocale(LC_MESSAGES,'az_AZ'); bindtextdomain("test","./locale"); textdomain("test"); echo _("text to translate"); ?> Expected result: ---------------- I would have expected gettext to work the same on both servers. Actual result: -------------- One server returned the expected result, the other just returned the message ID (gettext parameter). I've found some similar reports on the web and here, but no solution yet; that's why I dug into it. Turns out, even if the correct .mo file is in the correct location, gettext fails if the respective *system* locale isn't installed. This is (somewhat) documented behaviour. But one doesn't get an exception, log entry or error message - just the default value. Which makes it REALLY hard to debug, especially when the server is a remote web host. I suggest changing the gettext interface such as not finding the system locales for the selected language (if they are _really_ necessary) throws an Exception the fact. That way, people at least know what happened. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=43570&edit=1