Skip to content

Commit 16c74f9

Browse files
author
Mike van den Hoek
committed
(fix): text domain was loaded too early
1 parent 4cdf132 commit 16c74f9

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

prefill-gravity-forms.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
* plugin overrides. The plugins_loaded action hook fires early, and precedes the setup_theme, after_setup_theme, init
3939
* and wp_loaded action hooks.
4040
*/
41-
\add_action('plugins_loaded', function () {
42-
$plugin = \OWC\PrefillGravityForms\Foundation\Plugin::getInstance(__DIR__)->boot();
41+
add_action('plugins_loaded', function () {
42+
$plugin = \OWC\PrefillGravityForms\Foundation\Plugin::getInstance(__DIR__);
43+
44+
add_action('after_setup_theme', function () use ($plugin) {
45+
$plugin->boot();
46+
});
4347
}, 10);

src/PrefillGravityForms/Foundation/Plugin.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public function __construct(string $rootPath)
4747
$this->rootPath = $rootPath;
4848
require_once __DIR__ . '/Helpers.php';
4949
$this->buildContainer();
50-
load_plugin_textdomain($this->getName(), false, $this->getName() . '/languages/');
5150
}
5251

5352
/**
@@ -95,13 +94,20 @@ public function boot(): bool
9594
return false;
9695
}
9796

97+
$this->loadTextDomain();
98+
9899
// Set up service providers
99100
$this->callServiceProviders('register');
100101
$this->callServiceProviders('boot');
101102

102103
return true;
103104
}
104105

106+
private function loadTextDomain(): void
107+
{
108+
load_plugin_textdomain($this->getName(), false, $this->getName() . '/languages/');
109+
}
110+
105111

106112
/**
107113
* Call method on service providers.

0 commit comments

Comments
 (0)