[wp-hackers] gettext with a $locale parameter

Malaiac malaiac at gmail.com
Sat May 9 14:28:22 GMT 2009


I'm working on extending the IXR server (to be used as an API for my plugin).
On the WP install standing as the API server, the locale is english.
The client may be in a different locale, and I'd like to write several
.mo/.po files to answer the API calls with the proper messages.

Small exemple :
if(!plugin_key_exists($args['key']))
return new IXR_Error(-1, __('Please send a valid API key','myplugin'));

The message will be in english, whatever mo/po files I put in myplugin
directory.

How should I call gettext to have stg like :
if(!plugin_key_exists($args['key']))
return new IXR_Error(-1, __get_message___('Please send a valid API
key','myplugin',$args['locale']));
?

Thanks,
Malaiac


More information about the wp-hackers mailing list