[wp-hackers] load_plugin_textdomain()

Stephen Rider wp-hackers at striderweb.com
Wed Jul 23 14:09:05 GMT 2008


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"

Stephen



More information about the wp-hackers mailing list