cant get gettext to work with php
| From: | Merlin | Date: | Mon, 24 Nov 2003 18:00:53 +0000 |
| Subject: | cant get gettext to work with php | ||
| Groups: | php.i18n | ||
| Request: | Send a blank email to php-i18n+get-638@lists.php.net to get a copy of this message | ||
Hi there,
I am trying to get I18n support working on my site. To do this I have isntalled gettext.
Somehow the translation does not work. I did everything the examples explained, but I do stillg get en text.
Here is what I did.
1. I creaed a test file:
<?php
// I18N support information here
$language = 'de';
putenv("LANG=$language");
setlocale(LC_ALL, $language);
// Set the text domain as 'messages'
$domain = 'messages';
bindtextdomain($domain, "/home/www/mydocs/x_dev/sprachen/gettext/locale");
textdomain($domain);
echo gettext("A string to be translated would go here");
?>
2. I extracted the text via command line:
xgettext -a test.php
3. I translated it and created a mo file with poedit (editor)
4. I moved the files into a de directory
/locale
/de
/LC_MESSAGES
messages.po
When I load the php file in the browser it still gives me the entlish language.
Has anybody an idea on what I am doing wrong?
Thank you for any help on that,
Merlin