Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Translation;
4
 
5
use Illuminate\Contracts\Support\DeferrableProvider;
6
use Illuminate\Support\ServiceProvider;
7
 
8
class TranslationServiceProvider extends ServiceProvider implements DeferrableProvider
9
{
10
    /**
11
     * Register the service provider.
12
     *
13
     * @return void
14
     */
15
    public function register()
16
    {
17
        $this->registerLoader();
18
 
19
        $this->app->singleton('translator', function ($app) {
20
            $loader = $app['translation.loader'];
21
 
22
            // When registering the translator component, we'll need to set the default
23
            // locale as well as the fallback locale. So, we'll grab the application
24
            // configuration so we can easily get both of these values from there.
25
            $locale = $app->getLocale();
26
 
27
            $trans = new Translator($loader, $locale);
28
 
29
            $trans->setFallback($app->getFallbackLocale());
30
 
31
            return $trans;
32
        });
33
    }
34
 
35
    /**
36
     * Register the translation line loader.
37
     *
38
     * @return void
39
     */
40
    protected function registerLoader()
41
    {
42
        $this->app->singleton('translation.loader', function ($app) {
43
            return new FileLoader($app['files'], $app['path.lang']);
44
        });
45
    }
46
 
47
    /**
48
     * Get the services provided by the provider.
49
     *
50
     * @return array
51
     */
52
    public function provides()
53
    {
54
        return ['translator', 'translation.loader'];
55
    }
56
}