1 | <?php |
||
15 | class LanguageDetectorServiceProvider extends ServiceProvider |
||
16 | { |
||
17 | /** |
||
18 | * Symfony translator. |
||
19 | * @var Translator |
||
20 | */ |
||
21 | protected $translator; |
||
22 | |||
23 | /** |
||
24 | * Illuminate Request. |
||
25 | * @var Request |
||
26 | */ |
||
27 | protected $request; |
||
28 | |||
29 | /** |
||
30 | * Configurations repository. |
||
31 | * @var Config |
||
32 | */ |
||
33 | protected $config; |
||
34 | |||
35 | /** |
||
36 | * Detector Drivers available and its shortcuts. |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $drivers = [ |
||
40 | 'browser' => 'Vluzrmos\LanguageDetector\Drivers\BrowserDetectorDriver', |
||
41 | 'subdomain' => 'Vluzrmos\LanguageDetector\Drivers\SubdomainDetectorDriver', |
||
42 | 'uri' => 'Vluzrmos\LanguageDetector\Drivers\UriDetectorDriver', |
||
43 | ]; |
||
44 | |||
45 | /** |
||
46 | * Bootstrap the application. |
||
47 | * |
||
48 | * @return void |
||
49 | */ |
||
50 | public function boot() |
||
62 | |||
63 | /** |
||
64 | * Register the package. |
||
65 | */ |
||
66 | public function register() |
||
70 | |||
71 | /** |
||
72 | * The services that package provides. |
||
73 | * |
||
74 | * @return array |
||
75 | */ |
||
76 | public function provides() |
||
85 | |||
86 | /** |
||
87 | * Disable cookie encryption for language cookie name. |
||
88 | */ |
||
89 | protected function registerEncryptCookies() |
||
97 | |||
98 | /** |
||
99 | * Register and publish configuration files. |
||
100 | * |
||
101 | * @return void |
||
102 | */ |
||
103 | protected function registerAndPublishConfigurations() |
||
111 | |||
112 | /** |
||
113 | * Register All drivers available. |
||
114 | * |
||
115 | * @return void |
||
116 | */ |
||
117 | protected function registerAllDrivers() |
||
142 | |||
143 | /** |
||
144 | * Get a config value. |
||
145 | * @param string $key |
||
146 | * @param mixed $default |
||
147 | * @return mixed |
||
148 | */ |
||
149 | protected function config($key, $default = null) |
||
153 | |||
154 | /** |
||
155 | * Register the detector instance. |
||
156 | * |
||
157 | * @return void |
||
158 | */ |
||
159 | protected function registerLanguageDetector() |
||
191 | |||
192 | /** |
||
193 | * Detect and apply language for the application. |
||
194 | */ |
||
195 | protected function detectAndApplyLanguage() |
||
201 | |||
202 | /** |
||
203 | * Get language.detector from container. |
||
204 | * |
||
205 | * @return LanguageDetector |
||
206 | */ |
||
207 | protected function getLanguageDetector() |
||
211 | |||
212 | /** |
||
213 | * Regiter in container the routePrefix. |
||
214 | * |
||
215 | * @return void |
||
216 | */ |
||
217 | protected function registerRoutePrefix() |
||
226 | |||
227 | /** |
||
228 | * Get a list of supported locales. |
||
229 | */ |
||
230 | protected function getSupportedLanguages() |
||
250 | } |
||
251 |