Skip to content

Commit 5a187be

Browse files
committed
fixed issue 311
1 parent 698a511 commit 5a187be

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/App/src/Middleware/TranslatorMiddleware.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ public function __construct(
5555
*/
5656
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
5757
{
58+
$cookieKey = $this->translatorConfig['cookie']['name'];
59+
5860
// add language key
59-
if (!empty($_COOKIE[$this->translatorConfig['cookie']['name']])) {
60-
$languageKey = $_COOKIE[$this->translatorConfig['cookie']['name']];
61+
if (isset($_COOKIE[$cookieKey]) && array_key_exists($_COOKIE[$cookieKey], $this->translatorConfig['locale'])) {
62+
$languageKey = $_COOKIE[$cookieKey];
6163
} else {
6264
$languageKey = $this->translatorConfig['default'];
6365

0 commit comments

Comments
 (0)