From 84f9bce2afd8bf941854299af46d124414095f7e Mon Sep 17 00:00:00 2001 From: Quentin Date: Mon, 29 Jun 2015 18:19:24 +0200 Subject: [PATCH] fix locale --- Router/I18nRouter.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Router/I18nRouter.php b/Router/I18nRouter.php index 2247615..94266c6 100644 --- a/Router/I18nRouter.php +++ b/Router/I18nRouter.php @@ -201,6 +201,12 @@ private function matchI18n(array $params, $url) $params['_route'] = substr($params['_route'], $pos + strlen(I18nLoader::ROUTING_PREFIX)); } + foreach($this->hostMap as $locale => $host) { + if ($host == $this->context->getHost()) { + $this->context->setParameter('_locale', $locale); + } + } + if (!($currentLocale = $this->context->getParameter('_locale')) && $this->container->isScopeActive('request')) { $currentLocale = $this->localeResolver->resolveLocale(