[wp-hackers] two-underscore function arguments?

Stephen Rider wp-hackers at striderweb.com
Thu Dec 3 04:35:49 UTC 2009

On Dec 2, 2009, at 2:57 AM, Ghodmode wrote:

> __('Duration', 'wpevents')
> Searching the web tells me it has something to do with translation, but
> all of the examples I've seen only have one argument.  What's that
> second argument?

The second parameter is the "context" (textdoamin) of the string.  WP Core is assumed, so Core doesn't need the second parameter.  Plugins on the other hand, need to load their own textdomain, and then include the textdomain as the second parameter.

It's a fairly common mistake in plugins to use __() for translation without the textdomain. Doesn't work that way....


More information about the wp-hackers mailing list