Hooking into loading backend translations hook for each module

parent 2951b67b
...@@ -16,6 +16,7 @@ use Modules\Core\Console\PublishThemeAssetsCommand; ...@@ -16,6 +16,7 @@ use Modules\Core\Console\PublishThemeAssetsCommand;
use Modules\Core\Events\BuildingSidebar; use Modules\Core\Events\BuildingSidebar;
use Modules\Core\Events\EditorIsRendering; use Modules\Core\Events\EditorIsRendering;
use Modules\Core\Events\Handlers\RegisterCoreSidebar; use Modules\Core\Events\Handlers\RegisterCoreSidebar;
use Modules\Core\Events\LoadingBackendTranslations;
use Modules\Core\Foundation\Theme\ThemeManager; use Modules\Core\Foundation\Theme\ThemeManager;
use Modules\Core\Traits\CanGetSidebarClassForModule; use Modules\Core\Traits\CanGetSidebarClassForModule;
use Modules\Core\Traits\CanPublishConfiguration; use Modules\Core\Traits\CanPublishConfiguration;
...@@ -87,6 +88,10 @@ class CoreServiceProvider extends ServiceProvider ...@@ -87,6 +88,10 @@ class CoreServiceProvider extends ServiceProvider
BuildingSidebar::class, BuildingSidebar::class,
$this->getSidebarClassForModule('core', RegisterCoreSidebar::class) $this->getSidebarClassForModule('core', RegisterCoreSidebar::class)
); );
$this->app['events']->listen(LoadingBackendTranslations::class, function (LoadingBackendTranslations $event) {
$event->load('core', array_dot(trans('core::core')));
$event->load('sidebar', array_dot(trans('core::sidebar')));
});
} }
/** /**
......
...@@ -4,6 +4,7 @@ namespace Modules\Dashboard\Providers; ...@@ -4,6 +4,7 @@ namespace Modules\Dashboard\Providers;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Modules\Core\Events\BuildingSidebar; use Modules\Core\Events\BuildingSidebar;
use Modules\Core\Events\LoadingBackendTranslations;
use Modules\Core\Traits\CanGetSidebarClassForModule; use Modules\Core\Traits\CanGetSidebarClassForModule;
use Modules\Core\Traits\CanPublishConfiguration; use Modules\Core\Traits\CanPublishConfiguration;
use Modules\Dashboard\Entities\Widget; use Modules\Dashboard\Entities\Widget;
...@@ -44,6 +45,10 @@ class DashboardServiceProvider extends ServiceProvider ...@@ -44,6 +45,10 @@ class DashboardServiceProvider extends ServiceProvider
BuildingSidebar::class, BuildingSidebar::class,
$this->getSidebarClassForModule('dashboard', RegisterDashboardSidebar::class) $this->getSidebarClassForModule('dashboard', RegisterDashboardSidebar::class)
); );
$this->app['events']->listen(LoadingBackendTranslations::class, function (LoadingBackendTranslations $event) {
$event->load('dashboard', array_dot(trans('dashboard::dashboard')));
});
} }
public function boot(StylistThemeManager $theme) public function boot(StylistThemeManager $theme)
......
...@@ -5,6 +5,7 @@ namespace Modules\Media\Providers; ...@@ -5,6 +5,7 @@ namespace Modules\Media\Providers;
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract; use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Modules\Core\Events\BuildingSidebar; use Modules\Core\Events\BuildingSidebar;
use Modules\Core\Events\LoadingBackendTranslations;
use Modules\Core\Traits\CanGetSidebarClassForModule; use Modules\Core\Traits\CanGetSidebarClassForModule;
use Modules\Core\Traits\CanPublishConfiguration; use Modules\Core\Traits\CanPublishConfiguration;
use Modules\Media\Blade\MediaMultipleDirective; use Modules\Media\Blade\MediaMultipleDirective;
...@@ -66,6 +67,11 @@ class MediaServiceProvider extends ServiceProvider ...@@ -66,6 +67,11 @@ class MediaServiceProvider extends ServiceProvider
BuildingSidebar::class, BuildingSidebar::class,
$this->getSidebarClassForModule('media', RegisterMediaSidebar::class) $this->getSidebarClassForModule('media', RegisterMediaSidebar::class)
); );
$this->app['events']->listen(LoadingBackendTranslations::class, function (LoadingBackendTranslations $event) {
$event->load('media', array_dot(trans('media::media')));
$event->load('folders', array_dot(trans('media::folders')));
});
} }
public function boot(DispatcherContract $events) public function boot(DispatcherContract $events)
......
...@@ -4,6 +4,7 @@ namespace Modules\Menu\Providers; ...@@ -4,6 +4,7 @@ namespace Modules\Menu\Providers;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Modules\Core\Events\BuildingSidebar; use Modules\Core\Events\BuildingSidebar;
use Modules\Core\Events\LoadingBackendTranslations;
use Modules\Core\Traits\CanGetSidebarClassForModule; use Modules\Core\Traits\CanGetSidebarClassForModule;
use Modules\Core\Traits\CanPublishConfiguration; use Modules\Core\Traits\CanPublishConfiguration;
use Modules\Menu\Blade\MenuDirective; use Modules\Menu\Blade\MenuDirective;
...@@ -47,6 +48,11 @@ class MenuServiceProvider extends ServiceProvider ...@@ -47,6 +48,11 @@ class MenuServiceProvider extends ServiceProvider
BuildingSidebar::class, BuildingSidebar::class,
$this->getSidebarClassForModule('menu', RegisterMenuSidebar::class) $this->getSidebarClassForModule('menu', RegisterMenuSidebar::class)
); );
$this->app['events']->listen(LoadingBackendTranslations::class, function (LoadingBackendTranslations $event) {
$event->load('menu', array_dot(trans('menu::menu')));
$event->load('menu-items', array_dot(trans('menu::menu-items')));
});
} }
/** /**
......
...@@ -5,6 +5,7 @@ namespace Modules\Setting\Providers; ...@@ -5,6 +5,7 @@ namespace Modules\Setting\Providers;
use Illuminate\Foundation\AliasLoader; use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Modules\Core\Events\BuildingSidebar; use Modules\Core\Events\BuildingSidebar;
use Modules\Core\Events\LoadingBackendTranslations;
use Modules\Core\Traits\CanGetSidebarClassForModule; use Modules\Core\Traits\CanGetSidebarClassForModule;
use Modules\Core\Traits\CanPublishConfiguration; use Modules\Core\Traits\CanPublishConfiguration;
use Modules\Setting\Blade\SettingDirective; use Modules\Setting\Blade\SettingDirective;
...@@ -52,6 +53,10 @@ class SettingServiceProvider extends ServiceProvider ...@@ -52,6 +53,10 @@ class SettingServiceProvider extends ServiceProvider
BuildingSidebar::class, BuildingSidebar::class,
$this->getSidebarClassForModule('setting', RegisterSettingSidebar::class) $this->getSidebarClassForModule('setting', RegisterSettingSidebar::class)
); );
$this->app['events']->listen(LoadingBackendTranslations::class, function (LoadingBackendTranslations $event) {
$event->load('settings', array_dot(trans('setting::settings')));
});
} }
public function boot() public function boot()
......
...@@ -4,6 +4,7 @@ namespace Modules\Tag\Providers; ...@@ -4,6 +4,7 @@ namespace Modules\Tag\Providers;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Modules\Core\Events\BuildingSidebar; use Modules\Core\Events\BuildingSidebar;
use Modules\Core\Events\LoadingBackendTranslations;
use Modules\Core\Traits\CanGetSidebarClassForModule; use Modules\Core\Traits\CanGetSidebarClassForModule;
use Modules\Core\Traits\CanPublishConfiguration; use Modules\Core\Traits\CanPublishConfiguration;
use Modules\Tag\Blade\TagWidget; use Modules\Tag\Blade\TagWidget;
...@@ -41,6 +42,10 @@ class TagServiceProvider extends ServiceProvider ...@@ -41,6 +42,10 @@ class TagServiceProvider extends ServiceProvider
BuildingSidebar::class, BuildingSidebar::class,
$this->getSidebarClassForModule('tag', RegisterTagSidebar::class) $this->getSidebarClassForModule('tag', RegisterTagSidebar::class)
); );
$this->app['events']->listen(LoadingBackendTranslations::class, function (LoadingBackendTranslations $event) {
$event->load('tags', array_dot(trans('tag::tags')));
});
} }
public function boot() public function boot()
......
...@@ -7,6 +7,7 @@ use Illuminate\Support\Facades\Validator; ...@@ -7,6 +7,7 @@ use Illuminate\Support\Facades\Validator;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Modules\Core\Composers\CurrentUserViewComposer; use Modules\Core\Composers\CurrentUserViewComposer;
use Modules\Core\Events\BuildingSidebar; use Modules\Core\Events\BuildingSidebar;
use Modules\Core\Events\LoadingBackendTranslations;
use Modules\Core\Traits\CanGetSidebarClassForModule; use Modules\Core\Traits\CanGetSidebarClassForModule;
use Modules\Core\Traits\CanPublishConfiguration; use Modules\Core\Traits\CanPublishConfiguration;
use Modules\Translation\Console\BuildTranslationsCacheCommand; use Modules\Translation\Console\BuildTranslationsCacheCommand;
...@@ -45,6 +46,10 @@ class TranslationServiceProvider extends ServiceProvider ...@@ -45,6 +46,10 @@ class TranslationServiceProvider extends ServiceProvider
BuildingSidebar::class, BuildingSidebar::class,
$this->getSidebarClassForModule('translation', RegisterTranslationSidebar::class) $this->getSidebarClassForModule('translation', RegisterTranslationSidebar::class)
); );
$this->app['events']->listen(LoadingBackendTranslations::class, function (LoadingBackendTranslations $event) {
$event->load('translations', array_dot(trans('translation::translations')));
});
} }
public function boot() public function boot()
......
...@@ -6,6 +6,7 @@ use Cartalyst\Sentinel\Laravel\SentinelServiceProvider; ...@@ -6,6 +6,7 @@ use Cartalyst\Sentinel\Laravel\SentinelServiceProvider;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Modules\Core\Events\BuildingSidebar; use Modules\Core\Events\BuildingSidebar;
use Modules\Core\Events\LoadingBackendTranslations;
use Modules\Core\Traits\CanGetSidebarClassForModule; use Modules\Core\Traits\CanGetSidebarClassForModule;
use Modules\Core\Traits\CanPublishConfiguration; use Modules\Core\Traits\CanPublishConfiguration;
use Modules\User\Console\GrantModulePermissionsCommand; use Modules\User\Console\GrantModulePermissionsCommand;
...@@ -68,6 +69,10 @@ class UserServiceProvider extends ServiceProvider ...@@ -68,6 +69,10 @@ class UserServiceProvider extends ServiceProvider
BuildingSidebar::class, BuildingSidebar::class,
$this->getSidebarClassForModule('user', RegisterUserSidebar::class) $this->getSidebarClassForModule('user', RegisterUserSidebar::class)
); );
$this->app['events']->listen(LoadingBackendTranslations::class, function (LoadingBackendTranslations $event) {
$event->load('users', array_dot(trans('user::users')));
$event->load('roles', array_dot(trans('user::roles')));
});
$this->commands([ $this->commands([
GrantModulePermissionsCommand::class, GrantModulePermissionsCommand::class,
RemoveModulePermissionsCommand::class, RemoveModulePermissionsCommand::class,
......
...@@ -4,6 +4,7 @@ namespace Modules\Workshop\Providers; ...@@ -4,6 +4,7 @@ namespace Modules\Workshop\Providers;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Modules\Core\Events\BuildingSidebar; use Modules\Core\Events\BuildingSidebar;
use Modules\Core\Events\LoadingBackendTranslations;
use Modules\Core\Services\Composer; use Modules\Core\Services\Composer;
use Modules\Core\Traits\CanGetSidebarClassForModule; use Modules\Core\Traits\CanGetSidebarClassForModule;
use Modules\Core\Traits\CanPublishConfiguration; use Modules\Core\Traits\CanPublishConfiguration;
...@@ -45,6 +46,12 @@ class WorkshopServiceProvider extends ServiceProvider ...@@ -45,6 +46,12 @@ class WorkshopServiceProvider extends ServiceProvider
BuildingSidebar::class, BuildingSidebar::class,
$this->getSidebarClassForModule('workshop', RegisterWorkshopSidebar::class) $this->getSidebarClassForModule('workshop', RegisterWorkshopSidebar::class)
); );
$this->app['events']->listen(LoadingBackendTranslations::class, function (LoadingBackendTranslations $event) {
$event->load('workshop', array_dot(trans('workshop::workshop')));
$event->load('modules', array_dot(trans('workshop::modules')));
$event->load('themes', array_dot(trans('workshop::themes')));
});
} }
public function boot() public function boot()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment