/** * Register the service provider. */ public function register() { if ($this->app instanceof \Laravel\Lumen\Application) { $this->inLumen = true; $this->app->configure('app'); unset($this->app->availableBindings['translator']); } parent::register(); $this->registerCommands(); }
/** * 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(); }