public function boot() { $this->app->bindShared('translator', function ($app) { $loader = $app['translation.loader']; $locale = $app['config']['app.locale']; $trans = new WarningTranslator($loader, $locale); $trans->setFallback($app['config']['app.fallback_locale']); return $trans; }); parent::boot(); }
public function boot() { $this->app->singleton('translator', function ($app) { $loader = $app['translation.loader']; $locale = $app['config']['app.locale']; $trans = new \Waterloomatt\Translation\Translator($loader, $locale); $trans->setFallback($app['config']['app.fallback_locale']); return $trans; }); parent::boot(); }
/** * Register the service provider. * * @return void */ public function register() { $this->mergeConfigFrom(__DIR__ . '/../config/translator.php', 'translator'); parent::register(); $this->registerCacheRepository(); $this->registerFileLoader(); $this->registerCacheFlusher(); $this->app->singleton('urilocalizer', UriLocalizer::class); $this->app[\Illuminate\Routing\Router::class]->middleware('localize', TranslationMiddleware::class); // Fix issue with laravel prepending the locale to localize resource routes: $this->app->bind('Illuminate\\Routing\\ResourceRegistrar', ResourceRegistrar::class); }
public function register() { parent::register(); $this->commands(['Ottowayne\\LangCheck\\LangCheckCommand']); $this->app->singleton('translator', function ($app) { $loader = $app['translation.loader']; $locale = $app['config']['app.locale']; $trans = new Translator($loader, $locale); $trans->setConfig($app['config']['langcheck']); return $trans; }); }
public function register() { // Register filter $this->app['lari18n'] = $this->app->share(function ($app) { return Lari18n::getInstance(); }); $this->app['router']->after(function ($request, $response) { if (Lari18n::isActivated()) { $this->app['lari18n']->modifyResponse($request, $response); } }); parent::register(); }
/** * Register the service provider. * * @return void */ public function register() { parent::register(); $this->registerWriter(); }
/** * Get the services provided by the provider. * * @return array */ public function provides() { return array_merge(parent::provides(), [PublishCommand::class]); }
/** * IOC alias provided by this Service Provider. * * @return array */ public function provides() { return array_merge(parent::provides(), ['translation.cache.repository', 'translation.uri.localizer', 'translation.loader']); }