Translation of plugin in MU-PLUGINS directory not working


I have successfully translated a child theme, but not the same result in mu-plugins folder.

The name of the plugin is “mu-functions.php”.
In this file I have added the “Text Domain: mu-functions” in the header and then I have loaded the textdomain:

add_action( 'plugins_loaded', 'myplugin_muload_textdomain' );
function myplugin_muload_textdomain() {
load_muplugin_textdomain( 'mu-functions', basename( dirname(__FILE__) ) . '/inc/languages' );

The structure of the plugin that I have created in the mu-plugins directory is the following:

In the same directory I have a “inc”(include) folder where I put all the other files that are being called through the “include_once()” function in “mu-function.php” file.
Along with this files, in the same “inc” folder directory, I have the “languages” folder where I have created the “mu-functions.pot” file that has been translated to Portuguese and then generated to both “.mo” and “.po” files.

In my child theme I had an issue with these “.mo” and “.po” files. I have found in another forum that I had to name them only by the locale (so in this case “pt_PT”) and not “Text-Domain-pt_PT”. This issue has been successfully solved.
Being so, for testing purposes I have generated 2 more other “.mo” and “.po” files.
These are the files that are in my languages folder:

  • mu-functions-pt_PT.po
  • mu-functions.pot
  • pt_PT.po

Can anybody, please, help me? What am I missing?

, Eduardo Leao 6 years 2016-12-10T15:55:50-05:00 0 Answers 105 views 0

Leave an answer