Home » Php » php – Ignore locale and use code instead with wordpress plugins

php – Ignore locale and use code instead with wordpress plugins

Posted by: admin February 25, 2020 Leave a comment

Questions:

I am translating one plugin in Spanish and I noticed that different WordPress with the same language but different countries ignore my file translations. Is there any way that I can only leave the .mo file as myplugin-es.mo (so it works for every Spanish speaking country) instead of myplugin-es_ES.mo

This is what I use to load the language translations

function myplugin_textdomain() {
    load_plugin_textdomain( 'my-plugin', FALSE, basename( dirname( __FILE__ ) ) . '/languages/' );
}
add_action( 'plugins_loaded', 'myplugin_textdomain' );
How to&Answers: