gettext()_ and the equivalent wordpress __() functions will all return the string you call with if there is no translation found.
A common thought is can I use a key / token in place of the source text so that my code never needs to change and just the translations get edited. Well, yes you can but there are some considerations:
- If no translation is found then you will get the key/token returned. There is no way round this, although you could create your own function call (or trap the wordpress gettext() ) and perform a default to the base language translation yourself if you wanted to.
- If you really want to use a key/token then just ensure all the languages have a translation evern if it involves copying the base language translation for now.
- Remember many languages are really different to English with very different word ordering and string lengths – having correct translations is really important to stop a site looking wrong for other language users.
- Lots and lots of developers will tell you just don’t do it, translate the base language translation for typo correction or minor edits, but rely on changing the text in code to cause translations to be required so that you don’t get in a situation of there being bad translations of changed text. As some put it: “the gettext() developers know what they are doing – get over it and do it their way”!
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.