i'm doing a wordpress plugin.
my_plugin.php
/*
* Plugin Name: my plugin
* Author: Vendetta
* Author URI: http://abel-olguin.com
* Text Domain: my_plugin
* Domain Path: /languages
*/
*.po and *.mo files are in lenguages and i call traslate whit
__("text in po", "my_plugin")
files *.po and *.mo in directory languages names:
my_plugin-en_US.po, my_plugin-es_ES.po...
but strings are not translated, always show everything in English and my browser is in spanish. what it's wrong?
You need to load your plugin’s translations files using the function load_plugin_textdomain()
.
function my_plugin_load_plugin_textdomain() {
load_plugin_textdomain( 'my-plugin', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
}
add_action( 'plugins_loaded', 'my_plugin_load_plugin_textdomain' );
Read more here: http://ottopress.com/tag/internationalization/