Apache gettext windows does not work/translate
- by Prashant Kandathil
I am new to gettext.
Here is my setup:
/Apache 2.2
PHP 5.3.6
Windows 7/
I have following code in the Apache/htdocs/test/index.php
<?php
$language = 'de_DE';
$translatefile = 'messages';
setlocale(LC_ALL, $language);
putenv("LANG=".$language);
bindtextdomain($translatefile, 'C:/locale');
textdomain($translatefile);
echo gettext("Hello World!");
?>
I used PoEdit to generate the necessary translations under locale/de_DE/LC_MESSAGES/messsages.po & messages.mo The charset I used was UTF-8
When I visit http://localhost/test, the result is Hello World! when it should be Hall Welt!
As a test, I opened command prompt and navigated to the test folder. Then I typed in
php index.php
The result that appeared in the console was
Hall Welt!
I am not sure why it is not working with Apache.