Gettext is not a translation

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

My app.po looks like this:

 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 this:

 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 .mo app is located at ./lang/de_DE/LC_MESSAGES/

The text is not translated, and I do not receive any error messages.

+6
php gettext
source share
1 answer

Have you checked if de_DE is set as a locale?

Check it out with locale -a .

If not, generate it using locale-gen de_DE .

+7
source share

All Articles