1 | <?php |
||
11 | class LocaleMiddleware implements MiddlewareInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var Translator |
||
15 | */ |
||
16 | private $translator; |
||
17 | |||
18 | /** |
||
19 | * LocaleMiddleware constructor. |
||
20 | * @param Translator $translator |
||
21 | * |
||
22 | * @Inject({"translator"}) |
||
23 | */ |
||
24 | 3 | public function __construct(Translator $translator) |
|
28 | |||
29 | |||
30 | |||
31 | /** |
||
32 | * Process an incoming server request and return a response, optionally delegating |
||
33 | * to the next middleware component to create the response. |
||
34 | * |
||
35 | * @param Request $request |
||
36 | * @param DelegateInterface $delegate |
||
37 | * |
||
38 | * @return Response |
||
39 | */ |
||
40 | 3 | public function process(Request $request, DelegateInterface $delegate) |
|
50 | |||
51 | /** |
||
52 | * @param string $locale |
||
53 | * @return string |
||
54 | */ |
||
55 | 2 | protected function normalizeLocale($locale) |
|
69 | } |
||
70 |