yum install gettext は不要だった
<?php
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
$language = ‘en’;
if (ereg(‘ja’, $_SERVER[‘HTTP_ACCEPT_LANGUAGE’])) {
$language = ‘ja_JP.UTF-8’;
}
// Set locale and default domain.
putenv(“LANG=$language”);
setlocale(LC_ALL, $language);
$domain = ‘messages’;
bindtextdomain($domain, “/var/www/html/sandbox/lang/locale”);
textdomain($domain);// Output
echo gettext(“Hello”);echo gettext(“World”);
1019 xgettext -n hello.php
1024 less messages.po
1026 mkdir locale
1027 mkdir locale/en
1028 mkdir locale/ja_JP
1029 mkdir locale/en/LC_MESSAGES
1030 mkdir locale/ja_JP/LC_MESSAGES
1031 cp messages.po locale/en/LC_MESSAGES/.
1032 mv messages.po locale/ja_JP/LC_MESSAGES/.
1033 cd locale/en/LC_MESSAGES/.
1034 msgfmt messages.po
1036 cd ../
1037 cd ../ja_JP/LC_MESSAGES/
1038 msgfmt messages.po