Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gettext not translating

Tags:

php

gettext

I installed the php-gettext package, and phpinfo() shows that gettext is enabled.

My app.po looks like:

msgid "Welcome" 
msgstr "Willkommen auf meiner Homepage!"

msgid "Hier you can find stuff about me."
msgstr "Hier finden Sie Informationen uber mich."`

My php file looks like:

putenv('LC_ALL=de_DE');
setlocale(LC_ALL, 'de_DE');
bindtextdomain("app", "./lang");
textdomain("app");

echo gettext("Welcome");
echo _('Hier you can find stuff about me.');

The app.mo is in ./lang/de_DE/LC_MESSAGES/

The text isn't getting translated and I'm not getting any error messages.

like image 918
MnomrAKostelAni Avatar asked Nov 09 '10 09:11

MnomrAKostelAni


1 Answers

Have you checked if de_DE is installed as a locale?

Check it with locale -a.

If not, generate it with locale-gen de_DE.

like image 113
masterofit Avatar answered Nov 08 '22 13:11

masterofit