I have a mo file
/data/lang/en_US/LC_MESSAGES/test.mo (translate foo => bar)
and use the following code to echo it
$locale = 'en_US';
$locale_dir = '/data/lang';
putenv("LC_ALL=$locale");
setlocale(LC_ALL, $locale);
bindtextdomain('test', $locale_dir);
textdomain('test');
echo _("foo"); // print foo
However, if I change
$locale = 'en_US.utf8';
Then it print the corrected answer, bar
And my system locale information:
locale -a
..
en_US
en_US.utf8
..
What would be the reason?