[SOLVED] Problem with gettext
Posted: Thu Jul 14, 2011 9:48 am
Hello.
I'll explain my problem.
First of all, I have to say that I'm using Linux and I have Apache, PHP, MySQL, phpmyadmin and two packages called php-gettext and poedit.
Well, I've followed several tutorials in Internet to make a multilingual webpage, or even a file. So, I create a file called test.php and I write this:
Then I create the .po file and the directories (locale/language_COUNTRY/LC_MESSAGES). I copy the file messages.po into locale/en_GB/LC_MESSAGES, then I write the translation and move messages.po (which I've made a copy from) into locale/es_ES/LC_MESSAGES. And I create the .mo files.
Finally, I edit the test.php file in this way:
And here is the problem: I can't see the text translated, only the original version. No matter what I do, I never can see the translations.
Can you help me? I hope I've explained everything well.
EDIT: I've followed this tutorial, step by step: http://mel.melaxis.com/devblog/2005/08/ ... g-gettext/
And I can't see the text in German, only and always in English
I'll explain my problem.
First of all, I have to say that I'm using Linux and I have Apache, PHP, MySQL, phpmyadmin and two packages called php-gettext and poedit.
Well, I've followed several tutorials in Internet to make a multilingual webpage, or even a file. So, I create a file called test.php and I write this:
Code: Select all
<?
echo _("Hello world");
?>Finally, I edit the test.php file in this way:
Code: Select all
<?
$language=(isset($_REQUEST['language']))?trim(strip_tags($_REQUEST['language'])):"en_GB";
putenv("LC_ALL=$language");
setlocale(LC_ALL, $language);
bindtextdomain("messages", "./locale");
textdomain("messages");
print "<p><a href=\"".$_SERVER['PHP_SELF']."?language=en_GB\">English</a> -
<a href=\"".$_SERVER['PHP_SELF']."?language=fr_FR\">French</a> -
<a href=\"".$_SERVER['PHP_SELF']."?language=es_ES\">Español</a></p>\n";
echo _("Hello world");
?>Can you help me? I hope I've explained everything well.
EDIT: I've followed this tutorial, step by step: http://mel.melaxis.com/devblog/2005/08/ ... g-gettext/
And I can't see the text in German, only and always in English