Feature: Adding Translation Service and Translation Seeder
This commit is contained in:
@@ -4,15 +4,12 @@ namespace Modules\Core\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Lunar\Models\Language;
|
||||
use Modules\Core\Command\AnonymizeCommand;
|
||||
use Modules\Core\Command\ExportCleanupCommand;
|
||||
use Modules\Core\Command\ExportCommand;
|
||||
use Modules\Core\Command\ImportCommand;
|
||||
use Modules\Core\Command\InstallLunarCommand;
|
||||
use Modules\Core\Command\MigrateImportCommand;
|
||||
use Modules\Core\Localization\LanguageCacheObserver;
|
||||
use Modules\Core\Localization\LocaleMiddleware;
|
||||
|
||||
class CoreServiceProvider extends ServiceProvider
|
||||
{
|
||||
@@ -27,9 +24,6 @@ class CoreServiceProvider extends ServiceProvider
|
||||
Blade::anonymousComponentPath(__DIR__ . '/../../resources/views', 'core');
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../../database/migrations');
|
||||
|
||||
$this->app['router']->aliasMiddleware('locale', LocaleMiddleware::class);
|
||||
Language::observe(LanguageCacheObserver::class);
|
||||
|
||||
$this->publishes([
|
||||
__DIR__ . '/../../config/core.php' => config_path('core.php'),
|
||||
__DIR__ . '/../../config/scout.php' => config_path('scout.php'),
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Core\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Lunar\Models\Language;
|
||||
use Modules\Core\Localization\Events\LanguageCreated;
|
||||
use Modules\Core\Localization\Events\LanguageDeleted;
|
||||
use Modules\Core\Localization\Events\LanguageUpdated;
|
||||
use Modules\Core\Localization\Events\TranslationCreated;
|
||||
use Modules\Core\Localization\Events\TranslationDeleted;
|
||||
use Modules\Core\Localization\Events\TranslationUpdated;
|
||||
use Modules\Core\Localization\LanguageCacheObserver;
|
||||
use Modules\Core\Localization\Listeners\FlushLanguageCache;
|
||||
use Modules\Core\Localization\Listeners\FlushTranslationCache;
|
||||
use Modules\Core\Localization\Listeners\LogTranslationActivity;
|
||||
use Modules\Core\Localization\Listeners\MigrateTranslationsForRenamedLanguage;
|
||||
use Modules\Core\Localization\LocaleMiddleware;
|
||||
|
||||
class LocalizationServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function boot(): void
|
||||
{
|
||||
$this->app['router']->aliasMiddleware('locale', LocaleMiddleware::class);
|
||||
Language::observe(LanguageCacheObserver::class);
|
||||
|
||||
foreach ([TranslationCreated::class, TranslationUpdated::class, TranslationDeleted::class] as $event) {
|
||||
Event::listen($event, FlushTranslationCache::class);
|
||||
Event::listen($event, LogTranslationActivity::class);
|
||||
}
|
||||
|
||||
foreach ([LanguageCreated::class, LanguageUpdated::class, LanguageDeleted::class] as $event) {
|
||||
Event::listen($event, FlushLanguageCache::class);
|
||||
}
|
||||
|
||||
Event::listen(LanguageUpdated::class, MigrateTranslationsForRenamedLanguage::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user