localization - PHP's gettext with en_US locale -
i have mo file
/data/lang/en_us/lc_messages/test.mo (translate foo => bar) and use following code 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 change
$locale = 'en_us.utf8'; then print corrected answer, bar
and system locale information:
locale -a .. en_us en_us.utf8 .. what reason?
Comments
Post a Comment