Page 1 of 1

gettext

Posted: Thu May 10, 2007 2:27 pm
by mrdebian
I'm going mad with this gettext thing....

I followed the tutorial outlined here:
http://mel.melaxis.com/devblog/2005/08/ ... g-gettext/
and did everything exactly as it said but I am not able to switch or even see the text in the 2nd language.

Is there any way to output more information (debug) to see why that happening?
Path and everything else is ok as the poedit parse the files great and creates the po file and its translations without any problem.
I have also restart apache several times without success.

Thanks a lot

Posted: Thu May 10, 2007 4:05 pm
by mrdebian
I managed to make it work but cannot switch to languages via the ?locale=en or ?locale=el.

It follows my existing code:

Code: Select all

//$locale = "en";
if (isSet($_GET["locale"])) $locale = $_GET["locale"];
$language = "el";
    putenv("LANGUAGE=$language");
    putenv("LANG=$language");
    setlocale(LC_ALL, $language);
$gettext_domain = 'messages';
bindtextdomain("messages", "./locale");
textdomain("messages");
Any help is much appreciated

Thanks

Posted: Thu May 10, 2007 4:40 pm
by mrdebian
I've just found it.
In case that anyone is interested in the proper code is:

Code: Select all

if (isSet($_GET["lang"])) $lang = $_GET["lang"];
//$lang = "el";
    putenv("LANGUAGE=$lang");
    putenv("LANG=$lang");
    setlocale(LC_ALL, $lang);
$domain = 'messages';
bindtextdomain($domain, "./locale");
textdomain($domain);