[wp-hackers] two-underscore function arguments?
Glenn Ansley
glenn at glennansley.com
Thu Dec 3 04:55:37 UTC 2009
Also related:
_e('Duration','textdomain') would echo it out while
__('Duration','textdomain') would simply return it.
On Wed, Dec 2, 2009 at 11:35 PM, Stephen Rider
<wp-hackers at striderweb.com> wrote:
>
> 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....
>
> Stephen
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list