gettext not translating
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')开发者_StackOverflow中文版;
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.
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
.
精彩评论