[wp-hackers] load_plugin_textdomain()

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


On Jul 23, 2008, at 8:48 AM, Otto wrote:

> What is the correct and forward compatible way to call
> load_plugin_textdomain() inside a plugin? Assume that I want the .mo
> files to be inside the plugin's own directory and not in a lang
> directory or some such thing.
>
> The codex and documentation is less than clear on this point, and the
> code is somewhat difficult to understand.


I just worked this out yesterday.

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' );

I'm sure you can adjust that for the .mo in the base plugin folder. ;-)

Stephen


More information about the wp-hackers mailing list