Apache 2.4 + PHP 5.5
putenv('LC_ALL=ru_RU');
setlocale(LC_ALL, 'ru_RU');
bindtextdomain('mydomain', '/absolute/path/to/messages');
textdomain('mydomain');
I'm absolutely sure, than I've mydomain.po
and mydomain.mo
files in /absolute/path/to/messages/ru_RU/LC_MESSAGES/
.
Also I gave these files to my colleague on OS X Maverics - worked fine.
I can't make php gettext working.
I've googled/stackoverflowed for about couple of hours, tried various solutions - still not working. What I do wrong?
I restart apache every time I change something to ensure gettext files is being reloaded.
Here is my locale -a
output:
miraage@ubuntu:~$ locale -a
C
C.UTF-8
....
en_GB.utf8
....
POSIX
ru_RU.utf8
ru_UA.utf8
One more cmd output:
miraage@ubuntu:~$ sudo locale-gen ru
Generating locales...
ru_RU.UTF-8... up-to-date
ru_UA.UTF-8... up-to-date
Generation complete.
Okay, I've figured out:
sudo locale-gen ru_RU
(added new locale, but different charset)
and
then setlocale(LC_ALL, 'ru_RU.UTF-8');
did all work.
Thanks for help.
It is a long time asked question, but maybe one more check will help someone who will try everything "just by instruction" and still doesn't work.
That is collision with
LANGUAGE
environment variable.In my case a while ago after a long fight, I figured out that it was causing the issue. Removing that environment variable
export LANGUAGE=
(empty, after=
) resolved normalsetLocale
behavior.