I'm having problems with gettext in PHP; i have two servers, one local (in which I development) in Windows (with vs.php) and works find, and other in Amazon EC2 (Ubuntu 12.04 updated), this is the production server and in this server the same code don't found.
This is my code:
I initialice the gettext with this.
function initialize_i18n($locale) {
$locales_root = "./librerias/noAuto/locale";
putenv('LANG='.$locale);
putenv("LC_ALL=" . $locale);
setlocale(LC_ALL,$locale);
$domains = glob($locales_root.'/'.$locale.'/LC_MESSAGES/messages*.mo');
if (count ($domains) > 0)
{
$current = basename($domains[0],'.mo');
$timestamp = preg_replace('{messages-}i','',$current);
bindtextdomain($current,$locales_root);
bind_textdomain_codeset( $current, "UTF-8" );
textdomain($current);
if ($locale == "en_US")
{
if( _("Modificar") === "Modify" ) {
$system->setDebug( "Translated correctly");
} else {
$system->setDebug( "Gettext don't working");
}
}
}
}
initialize_i18n("en_US");
All files in my projects is coded in UTF-8 (in spanish Language), and the .mo and .po has been generated with poedit.
I try to reload apache service but did not work.
Any idea?