Reputation: 157
I have a controller with a redirect like this:
return $this->redirect(
$this->generateUrl(
'my_route',
array(
'stuff1' => $stuff1,
'stuff2' => $stuff2,
)
)
);
The route controller has the route defined for various languages:
my_route:
locales: { en: "/{stuff1}/{stuff2}", es: "/{stuff1}/{stuff2}" }
defaults: { _controller: myBundle:Controller:my_route}
It always redirects to 'en'. How can I force to redirect it to 'es'?
Upvotes: 3
Views: 2669
Reputation: 41934
Use:
return $this->redirect(
$this->generateUrl(
'my_route',
array(
'stuff1' => $stuff1,
'stuff2' => $stuff2,
'_locale' => 'es',
)
)
);
Upvotes: 6