Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pmaxs committed Sep 25, 2016
1 parent 91f988a commit 93f4b81
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/EventListener/LocaleListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ protected function getExcludeRoutesReg()
$exclude_routes_reg = false;
}


return $exclude_routes_reg;
}
}
3 changes: 2 additions & 1 deletion src/Provider/LocaleServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class LocaleServiceProvider implements ServiceProviderInterface
*/
public function register(Application $app)
{
$app['locale.resolve_by_host'] = false;
$app['locale.exclude_routes'] = [];
$app['locale.fake_index_route'] = 'locale-index0';

Expand Down Expand Up @@ -60,7 +61,7 @@ public function boot(Application $app)
array_merge($app['locale.exclude_routes'], [$app['locale.fake_index_route']])
));

if (!$this->resolve_by_host) {
if (!$app['locale.resolve_by_host']) {
$app['routes']->add($app['locale.fake_index_route'], new Route(
'/{locale0}/',
['locale0' => '', '_controller' => null],
Expand Down
5 changes: 4 additions & 1 deletion src/Utils/UrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ public function getUrlForLocale($url, $locale, $absolute = false)
return $url;

} else {
if (!strlen($url_parts['path']) && !strlen($url_parts['query'])) {
if (
(!isset($url_parts['path']) || !strlen($url_parts['path']))
&& (!isset($url_parts['query']) || !strlen($url_parts['query']))
) {
return $url;
}

Expand Down

0 comments on commit 93f4b81

Please sign in to comment.