load_plugin_textdomain doestn’t work with add_action plugins_loaded

In case of someone see this,

Following worked for me with 4 changes :

  1. translated files only in plugin lang dir
  2. using “init” hook instead of “plugins_loaded” and be sure strings to translate are loaded after this one
  3. using get_user_locale() to be sure to show the right language for logged users (if not logged, this return get_locale())
  4. translations files names are like this : en_US.mo/po, fr_FR.mo/po…
function myplugin_lang_init() {
    $domain = 'mydomain';
    $plugin_dir_lang = plugin_dir_path( __FILE__ ) . 'languages'; // assume that current php file is in plugin root directory
    // The "plugin_locale" filter is also used in load_plugin_textdomain()
    $locale = apply_filters('plugin_locale', get_user_locale(), $domain); // use get_user_locale() instead of get_locale()
    load_textdomain($domain, $plugin_dir_lang . "https://wordpress.stackexchange.com/" . $locale . '.mo');
    load_plugin_textdomain($domain, FALSE, $plugin_dir_lang);
}
// myplugin_lang_init(); // That works
add_action('init', 'myplugin_lang_init'); // use init instead of plugins_loaded