Page 1 of 1

gettext not working under remote server

Posted: Thu Jun 03, 2010 7:20 am
by thosecars82
Hello
I have a problem.
I use gettext in a website and it seems to work fine under a local xampp installation with PHP 5.3.1
on Windows. However, when I upload the website to a server, it seems as if gettext was not working because I do not see the corresponding translations. The server has PHP 5.2.10 and Apache ver. 2.2.13 (Unix). I have made sure though, that gettext is enabled by looking at phpinfo in the server.

This is part of the code:

putenv("LC_ALL=$locale");
setlocale(LC_ALL, $locale);
bindtextdomain("messages", dirname(__FILE__) . "/locale");
textdomain("messages");

It seems to me this code is fine, but I still think the problem might be related with the path. I do not know how to debug this to verify the path used by bindtextdomain. Does bindtextdomain throw any kind of exception that I can catch with php in case bindtextdomain does not find the path given as dirname(__FILE__) . "/locale"?

Any other suggestion?
Thanks

Re: gettext not working under remote server

Posted: Thu Jun 03, 2010 7:57 am
by phdatabase
Have you checked the manual http://us.php.net/manual/en/book.gettext.php ? Seems to be a lot of platform exceptions.

Re: gettext not working under remote server

Posted: Thu Jun 03, 2010 8:31 am
by thosecars82
It is solved now.
Sorry,
I eventually noticed that the $locale variable had not been properly set.
Thanks