Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
For who have experience with localization and gettext function
I use a WAMP server on Windows and make a test project. I have these files in the website folder:

C:\wamp\www\project\locale\ar_EG\LC_MESSAGES\messages.po C:\wamp\www\project\locale\en_US\LC_MESSAGES\messages.po


Below is the PHP Code:

PHP
$language="en_US";
$encoding = "UTF-8";
putenv("LANG=".$language);
setlocale(LC_ALL,$language);
$domain="messages"; // name of PO file
bindtextdomain($domain,"Locale");
bind_textdomain_codeset($domain, $encoding);
textdomain($domain);
echo gettext("name");


Above code is working fine. When I try to replace en_US with ar_EG it also displays the translation for en_US, and when I try to remove the en_US folder and try again it displays the msgid not msgstr.

I searched and found that there is a problem with setlocale function on the Windows platform, but I need a solution for it to run on Windows , any idea ?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900