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