mirror of
https://github.com/pelican-dev/panel.git
synced 2025-11-09 12:29:29 +01:00
load translations earlier
This commit is contained in:
parent
10dd7b7b47
commit
b0e5c7cc4a
@ -55,6 +55,14 @@ class PluginService
|
|||||||
config()->set($plugin->id, require $config);
|
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
|
// Autoload src directory
|
||||||
if (!array_key_exists($plugin->namespace, $classLoader->getClassMap())) {
|
if (!array_key_exists($plugin->namespace, $classLoader->getClassMap())) {
|
||||||
$classLoader->setPsr4($plugin->namespace . '\\', plugin_path($plugin->id, 'src/'));
|
$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
|
// Load views
|
||||||
$views = plugin_path($plugin->id, 'resources', 'views');
|
$views = plugin_path($plugin->id, 'resources', 'views');
|
||||||
if (file_exists($views)) {
|
if (file_exists($views)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user