I am trying to setup internationalization in PHP on a CentOS server running PHP 7.1
Here is my directory structure:
/home/project/public_html/locale/japanese/LC_MESSAGES/messages.po
/home/project/public_html/locale/japanese/LC_MESSAGES/messages.mo
/home/project/public_html/index.php
the messages.po containst the line (among others):
"Language: japanese\n"
"Content-Type: text/plain; charset=UTF-8\n"
I have the following code:
$check_putenv = putenv("LC_ALL=japanese");
if (!$check_putenv) {
echo "Warning: putenv LC_ALL failed!\n";
}
$check_putenv2 = putenv("LANGUAGE=japanese");
if (!$check_putenv2) {
echo "Warning: putenv LANGUAGE failed!\n";
}
$check_locale = setlocale(LC_MESSAGES, 'japanese');
if (!$check_locale) {
echo "Warning: Failed to set locale japanese!\n";
}
$check_bind = bindtextdomain("messages", "/home/project/public_html/locale");
if (!$check_bind) {
echo "Warning: Failed to bind text domain!\n";
}
$check_textdomain = textdomain("messages");
if ($check_textdomain !== "messages") {
echo "Warning: Failed to set text domain!\n";
}
the output is
Warning: Failed to bind text domain!
locale -a returns (among others)
ja_JP
ja_JP.utf8
japanese
any idea what could be wrong?