Reputation: 48973
When you call the gettext php function for translating text to another language, it uses the text you have on the page to act as the KEY/ID to lookup the value to replace it with
echo gettext('hello how are you today');
that would be the text used to lookup the translation, however I would like to use something like this
echo gettext('welcome_message');
and have that translated into English and any other language I offer. So how could I make this happen? How can I make gettext function ALWAYS use a language file? So if my default language is English for the site then instead of gettext showing welcome_message to an English user it would show hello how are you today
Is it as simple as just creating an English language file in addition to the other language files?
Upvotes: 0
Views: 2124
Reputation: 62914
You're on the right track. The string argument to gettext() is just an identifier, not a "default language". If there is no translation in the active locale, then gettext will return that identifier.
Your solution is just what you suspect: just create an English translation file.
Upvotes: 7