[wp-hackers] load_plugin_textdomain()

Omry Yadan omry at yadan.net
Fri Jul 25 14:37:50 GMT 2008


Stephen Rider wrote:

>
> On Jul 23, 2008, at 9:02 AM, Stephen Rider wrote:
>
>>> What is the correct and forward compatible way to call
>>> load_plugin_textdomain() inside a plugin?
>
>> This works for me, with .mo in a /languages/ folder inside the plugin 
>> folder:
>>
>> $plugin_dir = basename(dirname(__FILE__));
>> load_plugin_textdomain( 'myplugin', 
>> 'wp-content/plugins/'.$plugin_dir.'/languages', 
>> $plugin_dir.'/languages' );
>
> To clarify this:
>
> load_plugin_textdomain( $domain, $path_from_abspath, 
> $path_from_plugins_folder )
>
> The second parameter is the path to the .mo file, relative to 
> ABSPATH.  This method is ***deprecated***, in favor of the third 
> parameter.
>
> The third parameter (which will override the second) is the relative 
> path of the .mo file from the /plugins/ folder, e.g. "myplugin" or as 
> above, "myplugin/languages"

That's a very nasty was to improve an API:
create another optional argument which overwrites the previous arguments?!



More information about the wp-hackers mailing list