asmar Posted May 13, 2007 Share Posted May 13, 2007 Hello all, I have a strange problem with gettext and need your help please. In the first instance I made a test using the following structure: includes/tests/locale/el/LC_MESSAGES/ Under the above dir are messages.po and messages.mo generated bu poedit On the includes/tests/ I placed also the localization.php and test-gettext.php Localization.php has the following code: if (isSet($_GET["lang"])) $lang = $_GET["lang"]; putenv("LANGUAGE=$lang"); putenv("LANG=$lang"); setlocale(LC_ALL, $lang); $domain = 'messages'; bindtextdomain($domain, "./locale"); textdomain($domain); and on the test-gettext.php I placed just an echo helloworld to see if it works. Everything is working fine and I am able to switch language without a problem by using the ?lang=el_GR Now, after that test I create new files and generate new po, mo files via poedit with the following structure: includes/locale/el_GR/LC_MESSAGES/ with messages.po and messages.mo inside and my code is under root folder en: en/ I tried either with el or el_GR(which I think is the right one according to locale.gen which its output is outlined below: $ cat /etc/locale.gen en_US ISO-8859-1 el_GR.UTF-8 UTF-8 en_GB.UTF-8 UTF-8 el_GR ISO-8859-7 None of the translations are working and cannot track where the problem is as all paths in my code are fine. I'm just including the localization.php in my forms like: require_once("../../includes/localization.php"); The funny thing is that everything was working fine in the initial test. After that test I changed only the directory structured. Any help is much appreciated. Link to comment https://forums.phpfreaks.com/topic/51152-gettext-problem/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.