Hi,
I just think this is worth of posting: gettext won't work when you install the 64 Bits version of WAMP. I lost three days trying to figure out this. Actually I tested with:
* WampServer: 2.4 / 64 bits
* Apache Version: 2.4.4
* PHP Version: 5.4.12
* OS: Windows 7 / 64 bits
And this is the code, which works with the 32 bits version:
define('LOCALE_DIR', '<root_dir_of_your_po_files>'); //ie: C:/wamp/www/your_app/locale
$locale = '<your_locale>'; //ie: es_CO
$domain = 'your_gettext_domain'; //ie: messages
putenv('LC_ALL=' . $locale);
bindtextdomain($domain, LOCALE_DIR);
textdomain($domain);
echo _('<your_string>'; // ie: Hello world
However with the 64 Bit version, it will use the systems locale, which on my case it is German (Switzerland).
I tried several versions of the code, which I found on several forums and realized that on windows you don't really need to call "setlocale" nor to set the LANG, LANGUAGE, and LC_MESSAGES environment variables. It is enough with the "LC_ALL" variable. "setlocale" will always failed unless you include a Windows like locale, ie: "Esp_Col", "Spanish_Colombia", or "Spanish_Col". Anyway, since it works without "setlocale", I just dropped that line.
I'm just wondering if this is a problem of apache 64 Bit for windows or it is really related to WAMP.
For the french speakers, I also found a reference to this problem on the french forum:
[
forum.wampserver.com]
Best regards
Josef
Edited 3 time(s). Last edit at 01/07/2014 11:10AM by jmeile.