3

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?

1

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/'

  • Yeah I saw that via trace file created by xdebug. However Thanks. – Salvio Sep 13 '18 at 8:41
0

Ok I made a mistake with dirname (FILE) . /languages/ and the fact that debuggin via load_plugin_textdomain I saw that it create the file name by the domaèn passed as argument to the function.

Thanks anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.