1

I have created the translation files using poedit and generated the mo files and kept them in their respective folders. But somehow I can only access the translations which are in en_GB and en_US folders. even I place DE translation in these folders it works.

Why It is unable to work with other locale? Is there any configration which I need to make or I am missing something?

this is the code which I am using.

switch ($_GET['language']) {
    case 'de' : $locale = 'de_DE'; break;
    case 'us' : $locale = 'en_US'; break;
    case 'fr' : $locale = 'fr_FR'; break;
    case 'es' : $locale = 'es_ES'; break;
    case 'it' : $locale = 'it_IT'; break;
    default : $locale = 'en_GB'; break;
}
putenv("LC_ALL=$locale");   
    setlocale(LC_ALL, $locale . '.UTF-8');
    $domname = 'default';
    bindtextdomain($domname, 'locale');
    textdomain($domname);
    bind_textdomain_codeset($domname, 'UTF-8');


echo gettext ("test123");
echo gettext ("hello every one");
Developer
  • 25,073
  • 20
  • 81
  • 128

1 Answers1

0

Are you sure that all the other locales you want to use are in UTF-8 ? In your example you add '.UTF-8' in setlocale().

Cédric Julien
  • 78,516
  • 15
  • 127
  • 132
  • does this matter for testing? while translation for "test123" is "test123 in French"? I think must be some configuration i need to change because it only works with en_GB and en_US. no matter what translation I place in their folder. Like if I try for french translation it does not work. and I place the french mo file in en_GB it works perfectly. so it means translation is correct but some how en_FR is not supportive. – Developer Jul 15 '11 at 14:46