Hi all,
I have a problem with getting gettext to work properly in PHP. Has anyone got it working using setlocale, bindtextdomain etc. Here is what I have tried so far ...
I am setting the locale from the default en_GB to another (here en_IE as it is definately installed on my machine as locale -a proves) as the page loads
setlocale(LC_ALL, 'en_IE');
echo "locale is ".setlocale(LC_MESSAGES,0));
bindtextdomain('messages', '/opt/myproj/locale');
textdomain('messages');
The echo returns en_IE as expected.
Inside /opt/myproj/locale I have
en_GB/LC_MESSAGES/messages.mo
en_IE/LC_MESSAGES/messages.mo
and neither are the same as the default text so that I can see if they are loaded.
The problem is this
1) If I set the locale to something unsupported, it finds the default text as expected 🙂
2) If I set the locale to en_GB, it finds the en_GB text as expected 🙂
3) If I set the locale to en_IE, it FAILS to find the en_IE text, but instead
displays the default text. :mad:
I am testing this on the same machine that is the web server, and am restarting the
webserver, and the browser in between changes. I am using LAMPP for apache
mysql and php, and it is compiled to use gettext (as tests 1&2 prove).
From everything I have read, this is the "correct" way to do it, but it still fails in
the third case.
Has anyone any idea what might be going wrong?
Thanks for any help, very much appreciated.
Neill