diff --git a/src/Base/Foundation/Plugin.php b/src/Base/Foundation/Plugin.php index b126175..d3f213f 100644 --- a/src/Base/Foundation/Plugin.php +++ b/src/Base/Foundation/Plugin.php @@ -47,7 +47,6 @@ class Plugin public function __construct(string $rootPath) { $this->rootPath = $rootPath; - \load_plugin_textdomain($this->getName(), false, $this->getName() . '/languages/'); $this->loader = new Loader(); @@ -95,6 +94,7 @@ public function boot(): bool // Register the Hook loader. $this->loader->addAction('init', $this, 'filterPlugin', 4); + $this->loader->addAction('after_setup_theme', $this, 'loadTextDomain', 4); $this->loader->register(); return true; @@ -138,6 +138,14 @@ public function filterPlugin(): void \do_action('owc/' . self::NAME . '/plugin', $this); } + /** + * Load the plugin textdomain. + */ + public function loadTextDomain(): void + { + \load_plugin_textdomain($this->getName(), false, $this->getName() . '/languages/'); + } + /** * Call method on service providers. *