diff --git a/app/Services/Helpers/PluginService.php b/app/Services/Helpers/PluginService.php index c76c55ce4..9e792e9fd 100644 --- a/app/Services/Helpers/PluginService.php +++ b/app/Services/Helpers/PluginService.php @@ -55,6 +55,14 @@ class PluginService config()->set($plugin->id, require $config); } + // Load translations + $translations = plugin_path($plugin->id, 'lang'); + if (file_exists($translations)) { + $this->app->afterResolving('translator', function ($translator) use ($plugin, $translations) { + $translator->addNamespace($plugin->id, $translations); + }); + } + // Autoload src directory if (!array_key_exists($plugin->namespace, $classLoader->getClassMap())) { $classLoader->setPsr4($plugin->namespace . '\\', plugin_path($plugin->id, 'src/')); @@ -88,14 +96,6 @@ class PluginService }); } - // Load translations - $translations = plugin_path($plugin->id, 'lang'); - if (file_exists($translations)) { - $this->app->afterResolving('translator', function ($translator) use ($plugin, $translations) { - $translator->addNamespace($plugin->id, $translations); - }); - } - // Load views $views = plugin_path($plugin->id, 'resources', 'views'); if (file_exists($views)) {