I’m creating a plugin and I’ve put:
define ('WPLANG', 'it_IT');
into wp-config.php
file.
After plugin Name in the Header of the Plugin declaration:
* Text Domain: endpoint
* Domain Path: /languages/
For the load domain:
add_action( 'plugins_loaded', 'myplugin_load_textdomain' );
function myplugin_load_textdomain() {
load_plugin_textdomain( 'endpoint', false, dirname( __FILE__ ) . '/languages/' );
}
In languages I created pot, po and mo file with this names: end-point.pot
, end-point-it_IT.po
and end-point-it_IT.mo
.
I switched to Italian but nothing is changed.
Any help?
2 Answers
1) Presuming you’re running WordPress 4.x. The WPLANG
constant does nothing. WordPress 3 and below defined the default language in wp-config.php
but since WordPress 4 setting your site language is done via the General Settings page in your admin area. Go to Settings > General and scroll to the bottom where is says “Site Language” next to a dropdown list.
2) The argument dirname(__FILE__).'/languages/'
is wrong as this should be a relative path. Use dirname(plugin_basename(__FILE__)).'/languages/'