Reputation: 71
I am quite new to WordPress theme development, I've been exploring some starter themes and trying to study how they develop their themes. I've learned how they translate the words or phrase by using __()
function and _e()
function, but I never saw some dynamic functions being translated using the __()
and _e()
functions (e.g. the_excerpt()
, the_title()
)
So my question is, is it okay to translate dynamic WordPress values using the __()
and _e()
functions? Particularly this code:
_e(the_title(), 'domain');
or, WordPress automatically translates the returned value, and it is not necessary to use those translator functions?
Upvotes: 0
Views: 245
Reputation: 1526
To translate dynamic values you have to use the __()
as you could run into issues if you don't. Here's some really nice information I read when I translated my first wordpress site, and it came out great.
You should know that these calls are called getText
wrappers... getText
is software found in most servers and you can find more info about it in their website:
Another awesome article on how to use these can be found in the I can localize website found here:
As usual your primary source for this should be the wordpress codex, while its not mega complete is the stem of this idea specific to a wordpress install.
Finally, here is a nice couple of tools that will help with the translation. This helps find your getText
calls from any PHP file (hint, you can upload a zip and it will generate a file that you can then use with Poedit.
Upvotes: 1