6
votes

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.

1
An interesting alternative to gettext is Zend_Translate.Pekka
"Hier you can find stuff about me" is an interesting translation...Tokk
@Tokk: That's true denglisch ;-)Boldewyn
@couchpot: The php-gettext package is PHP's gettext library, isn't it? Or do you refer to this: savannah.nongnu.org/projects/php-gettextBoldewyn
I installed the ubuntu packageMnomrAKostelAni

1 Answers

7
votes

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.