## localization – How to properly load text domain of custom mu plugin

Question

I can’t manage to load the text domain of my plugins and it’s slowly but surely driving me nuts; especially cuz all the error feedback I get is: false.

What I’ve tried so far (adding the following code in my main plugin file):

add_action(
'init',
function() {
}
);


This results in an error when a page is loaded in the default language (load_muplugin_textdomain() returns false), and fails to localize dynamic strings (e.g. when you make an AJAX request to the server whose answer includes __( 'Hello', 'my-mu-plugin' ), and your current locale is not english, you still get ‘Hello’ back from the server)

According to the actual wp docs:

function my_plugin_load_my_own_textdomain( $mofile,$domain ) {
if ( 'my-mu-plugin' === $domain && false !== strpos($mofile, WP_LANG_DIR . '/plugins/' ) ) {
$locale = apply_filters( 'plugin_locale', determine_locale(),$domain );
$mofile = WPMU_PLUGIN_DIR . "https://wordpress.stackexchange.com/" . dirname( plugin_basename( __FILE__ ) ) . '/languages/' .$domain . '-' . $locale . '.mo'; } return$mofile;
}

I’ve added all of my .mo files from my mu-plugins/my-my-plugin/languages folder into the wp-content/languages/pugins folder, which was not the case yet; and now I get the same problem for both the codes shown above: static contents are correctly translated according to the current locale, but dynamic contents in the wp admin (like server responses which contain __() strings, retrieved via AJAX) are always output in the root default language.