i18n not working
Author: erikyoCreated Sep 7, 2021Updated Oct 10, 2024
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!
Source: DevinVinson/WordPress-Plugin-Boilerplate