Skip to content

Commit

Permalink
fixes another case where locale resolver does not produce a result
Browse files Browse the repository at this point in the history
  • Loading branch information
schmittjoh committed Apr 22, 2012
1 parent f063a55 commit 6578eea
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Router/I18nRouter.php
Expand Up @@ -164,6 +164,12 @@ public function match($url)
&& $this->container->isScopeActive('request')) {
$currentLocale = $this->localeResolver->resolveLocale(
$this->container->get('request'), $params['_locales']);

// If the locale resolver was not able to determine a locale, then all efforts to
// make an informed decision have failed. Just display something as a last resort.
if (!$currentLocale) {
$currentLocale = reset($params['_locales']);
}
}

if (!in_array($currentLocale, $params['_locales'], true)) {
Expand Down

0 comments on commit 6578eea

Please sign in to comment.