Morning,
I have a php project that uses the gettext functionality to translate the texts. I have two languages in my project, Spanish and English.
The language file structure is the next:
/locale/en_US/LC_MESSAGES/plantasenelaire.mo
/locale/es_ES/LC_MESSAGES/plantasenelaire.mo
The php code that I am using to select one language or another is the next:
if($languageCode == "en")
{
$languageEncode = "en_US";
}
elseif($languageCode == "es")
{
$languageEncode = "es_ES";
}
else
{
$languageEncode = "en_US";
}
putenv("LC_ALL=$languageEncode");
setlocale(LC_ALL, $languageEncode);
bindtextdomain("plantasenelaire", "./locale/");
textdomain("plantasenelaire");
bind_textdomain_codeset("plantasenelaire", 'UTF-8');
The code works just fine when using wamp 2.4 (32bits) with Apache 2.4.4 and PHP 5.4.16 on my Windows 7 64 bits.
The code also works fine on my linux shared hosting when using PHP 5.6 or PHP 7
Today I decided uninstall my wamp 2.4 and upgrade to wamp 3 with Apache 2.4.23 – PHP 5.6.25/7.0.10. I have installed all the Visual C++ Packages needed and then installed wamp 3 64 bits.
The code works but the language is always in Spanish no matter what I do. Always Spanish no matter if I use PHP 5.6 or 7.
I have tried multiples combinations and codes for the putenv and setlocale functions that I have found on the Internet without any luck :/
After trying wamp 3 (32 and 64 version) I went back to wamp 2.4, just to check if any of the Visual C++ Packages I installed messed up something on my Windows...
Everything works fine on wamp 2.4 with Apache 2.4.4 and PHP 5.4.16. It also works fine in my hosting as I said with PHP 5.6 and 7.
I don't know why is happening this.
Anyone can help me here? Any suggestion is welcomed.
Thank you a lot!
I have a php project that uses the gettext functionality to translate the texts. I have two languages in my project, Spanish and English.
The language file structure is the next:
/locale/en_US/LC_MESSAGES/plantasenelaire.mo
/locale/es_ES/LC_MESSAGES/plantasenelaire.mo
The php code that I am using to select one language or another is the next:
if($languageCode == "en")
{
$languageEncode = "en_US";
}
elseif($languageCode == "es")
{
$languageEncode = "es_ES";
}
else
{
$languageEncode = "en_US";
}
putenv("LC_ALL=$languageEncode");
setlocale(LC_ALL, $languageEncode);
bindtextdomain("plantasenelaire", "./locale/");
textdomain("plantasenelaire");
bind_textdomain_codeset("plantasenelaire", 'UTF-8');
The code works just fine when using wamp 2.4 (32bits) with Apache 2.4.4 and PHP 5.4.16 on my Windows 7 64 bits.
The code also works fine on my linux shared hosting when using PHP 5.6 or PHP 7
Today I decided uninstall my wamp 2.4 and upgrade to wamp 3 with Apache 2.4.23 – PHP 5.6.25/7.0.10. I have installed all the Visual C++ Packages needed and then installed wamp 3 64 bits.
The code works but the language is always in Spanish no matter what I do. Always Spanish no matter if I use PHP 5.6 or 7.
I have tried multiples combinations and codes for the putenv and setlocale functions that I have found on the Internet without any luck :/
After trying wamp 3 (32 and 64 version) I went back to wamp 2.4, just to check if any of the Visual C++ Packages I installed messed up something on my Windows...
Everything works fine on wamp 2.4 with Apache 2.4.4 and PHP 5.4.16. It also works fine in my hosting as I said with PHP 5.6 and 7.
I don't know why is happening this.
Anyone can help me here? Any suggestion is welcomed.
Thank you a lot!