]> BookStack Code Mirror - bookstack/blob - app/Providers/TranslationServiceProvider.php
Format update
[bookstack] / app / Providers / TranslationServiceProvider.php
1 <?php namespace BookStack\Providers;
2
3
4 use BookStack\Translation\Translator;
5
6 class TranslationServiceProvider extends \Illuminate\Translation\TranslationServiceProvider
7 {
8     /**
9      * Register the service provider.
10      *
11      * @return void
12      */
13     public function register()
14     {
15         $this->registerLoader();
16
17         $this->app->singleton('translator', function ($app) {
18             $loader = $app['translation.loader'];
19
20             // When registering the translator component, we'll need to set the default
21             // locale as well as the fallback locale. So, we'll grab the application
22             // configuration so we can easily get both of these values from there.
23             $locale = $app['config']['app.locale'];
24
25             $trans = new Translator($loader, $locale);
26
27             $trans->setFallback($app['config']['app.fallback_locale']);
28
29             return $trans;
30         });
31     }
32 }