Skip to content

Commit faa37f1

Browse files
authored
Merge pull request #313 from dotkernel/issue-311
fixed issue 311
2 parents 698a511 + 5a187be commit faa37f1

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)