translation does not work with text_domain

From the source code of load_plugin_textdomain it becomes appararent that the function will first look for $domain . '-' . $locale . '.mo' (so, that’s myplugin-fr_FR.mo) in WP_LANG_DIR . '/plugins/' . $mofile.

Only when the file is not there, it will start looking at the specified path and if it is not there in the main plugin directory. So, if you don’t get the mo-file in the specified directory, either it isn’t there or you are supplying the wrong path.

I cannot see whether you have made any typos, but instead of combining dirname and plugin_basename you might want to stick to plugin_dir_path to supply the correct directory.

Leave a Comment