Search code examples
phplocalizationmultilingualgettextpoedit

Gettext not working on wamp upon updating


I have recently updated my wamp server (32 bit). Gettext was perfectly working but immediately after the upgrade, it stopped and i am thus now not able to view the localized version of my website (unlike before).

I have of course used the 32 bit wamp version and re-installed gettext, and also enabled the gettext extension in the php .ini file (in fact, the new wamp version had this already enabled)

I am not getting any errors from my files. the locale file looks as such.

locale.php

<?php

session_start();

if (isset($_GET["lang"])) {
    $language = $_GET["lang"];
}
else if (isset($_SESSION["lang"])) {
    $language = $_SESSION["lang"];
}
else {
    $language = "en_US";
}

$_SESSION["lang"] = $language;

$folder = "locale";
$domain = "messages";
$encoding = "iso-8859-1";
$locale = $language.".".$encoding;

putenv("LANG=" . $language); 
setlocale(LC_ALL, $language);
bindtextdomain($domain, $folder);
textdomain($domain);
bind_textdomain_codeset($domain, $encoding);



?> 

PS: I have tried deploying the files onto a remote server and the files work perfectly out there (localization is working).

Any assistance would be highly appreciated. Thanks...


Solution

  • Finally got it working. All I had to do is un-install the new updated wamp 2.5 and installed an earlier version 2.2c 32bit and it worked.