DevinVinson / WordPress-Plugin-Boilerplate

[WordPress] A foundation for WordPress Plugin Development that aims to provide a clear and consistent guide for building your plugins.
http://wppb.io
7.66k stars 2.25k forks source link

i18n not working #570

Open erikyo opened 3 years ago

erikyo commented 3 years ago

Hi, I realised the translations were not working, and after some investigation I discovered that plugin's translations should not be loaded during the plugins_loaded action. This because prevents other language-related plugins from properly hooking into the load_textdomain() function, so load_plugin_textdomain() should be triggered during init action. reference

the change is needed here: $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );

must be changed in this way: $this->loader->add_action( 'init', $plugin_i18n, 'load_plugin_textdomain' );

hope it helps

ps. thanks for this useful boiler template!