localisation of website using gettext

562 views Asked by At

I have to translate the text in english to germany.For that I have done the folllownig I have used gettext and working on Ubuntu 11.10 os...

  1. created a text.php

  2. Through Poedit created messages.po and messages.mo(automatically created).

    Both .po and .mo file reside in "locale/de_DE/LC_MESSAGES."

  3. Then created the localization.php in the same location where the file text.php resides.

But still When I tested the file text.php it gave output as untranslated string....

Why was it so? Have done any mistake or left something else......?

Could anybody help me out?

2

There are 2 answers

0
Kris On

Have a look at this page: http://php.net/manual/en/function.gettext.php, the example shows which initialization to do before the gettext() or _() functions actually translate text.

0
AudioBubble On

Gettext is not magic. It doesn't translate output on its own when localization files exist; you have to explicitly call the gettext() function whenever you want it to translate a string.