I'm trying to create language/locale switch urls using Symfony2 and twig which will allow to switch language for route without resetting url:
http://example.com/en/cat/test
http://example.com/it/cat/test
http://example.com/sp/cat/test
... and so on
Here is revelant part of my twig template:
<a href="{{ path(app.request.attributes.get('_route'),{'_locale':'en'})}}">English</a>
My problem is that for example using category url(http://example.com/en/cat/test) gives me exception:
The "_category" route has some missing mandatory parameters ("category").
Which is all okay and understandable since for switcher urls I'm passing only _locale param.
How to pass all current url params?