Mike5
Mike5

Reputation: 91

Gettext php, idea ?

I installed gettext on a server and want to use for a php script..

I use with 3 languages. The original website is written in english..

Other are french and Italian.

I can without problem change language to French or Italian.. But when I want load the en_EN.mo file to replace the origine text of the php file, the translation are not loaded.

I try many things.. Remove file, replace name.. restart apache..

Nothing.. it work perfectly with all other langage, but impossible to use a english file.

I create new language.. it work too.. but never the en_EN..

All my files langage are in the same tree style

if I force to use..

$directory = './locale';
$domain ='en_EN';
$locale ='en_EN';

putenv('LC_ALL='.$locale);
setlocale(LC_ALL, $locale);
bindtextdomain($domain, $directory);
textdomain($domain);
bind_textdomain_codeset($domain, 'UTF-8');

no result..

My problem is that I have no idea how to debug it ? Where can I find a log or something to help ? Where see errors ?

It's strange that it work with all lang, but not english.. I use Poedit to create my file, I have create the file many time.. in the same way that other..

Please share your idea :)

Upvotes: 0

Views: 74

Answers (1)

Václav Slavík
Václav Slavík

Reputation: 6690

I create new language.. it work too.. but never the en_EN..

You misunderstand what the locale string means. It is not “2 language code letters followed by the same letters in uppercase” (that wouldn’t make any sense, would it), it is “language code followed by country code” per ISO 3166. And “EN” is not only not a valid country code for any country that speaks English, it’s not a valid country at all. You’re asking WordPress to run under the English locale (presumably), but only providing it translation files for “English in a made-up country” locale that WP is never going to look for.

You’re thinking of en_US.

Upvotes: 2

Related Questions