I'm trying to use gettext on a website, and for that I'm following the O'Reilly Media tutorial. At the end of page one, it is saying that I need to use the command xgettext -n *.php
, but my command line returns the following: 'xgettext' is not recognized as an internal or external command, operable program or batch file.
I'm running my website on XAMPP, so the my whole directory is like this:
xampp/htdocs/gettext/locale/en/lc_messages/
I have my test.php in the gettext folder, and the messages.po in the en
folder. Even when I try to use poedit, it doesn't work. Here is my test.php code:
<?php
// I18N support information here
$language = 'en';
putenv("LANG=$language");
setlocale(LC_ALL, $language);
// Set the text domain as 'messages'
$domain = 'messages';
bindtextdomain($domain, "localhost/gettext/locale");
textdomain($domain);
echo "<br>";
echo gettext("A string to be translated would go here");
?>
I'm not really sure the string in the bindtextdomain function is correct. Anybody have any clue?
EDIT.:I forgot to mention that I was using Windows. I've already checked the php directory, the gettext extension is there, and it is enabled in the php.ini configuration file.