I've create a plugin for wordpress and now I want translate it. I've adding in my code .po and .mo files in "Plugin-name/locale" (I've create "locale" folder where I put de_DE, fr_FR, en_US, it_IT, es_ES, ru_RU folders) Every language folder contains a folder called "LC_MESSAGES" containing .po and .mo file like "translation.mo and transolation.po" Now I want connect these translation. In my Config file I've created something like this:
$locale = str_replace("-", "_", $culture);
$textDomain = "translation";
try {
@putenv("LC_ALL=$locale");
}
catch (Exception $e) { }
setlocale(LC_ALL, $locale . ".utf8"); //Set language
bindtextdomain($textDomain, dirname(__FILE__) . "/locale"); //Specify location of translation tables
textdomain($textDomain); //Choose domain
and in my page I've just added the gettext like:
_("Hello")
My site is in italian so I will see "Ciao" but the plugin doesn't take the translation so I see still "Hello"
Can anyone help me ?
Thanks in advance
With Wordpress you need to be using this format normally: either
or