Symfony twig模板链接到更改的前缀

Is there any way in Symfony2 to put the link(in the twig template), which would change the prefix set in the app/config/routing.yml? For eample, here's my app/config/routing.yml file:

    acme_main:
    resource: "@AcmeMainBundle/Resources/config/routing.yml"
    prefix:   /{_locale}/
    requirements: 
        _locale: |en|fr|de

And I want to insert 3 links which are supposed to change the locale(it's about the translation, but it doesn't matter, let's focus on the prefix in general). How would I do that? I tried something like this

<a href="{{ path('route_x') }}"><img src="{{ asset('path/path/path/some_flag.jpg') }}"></a>

Where route_x is route defined in the routing.yml of the specific bundle, but I couldn't figure it out to work. Form this level prefix is untouchable. Is there any way or am I doing it wrong? Please help! :)

You can explicitly set _locale in the path function:

{{ path('route_x', {_locale: ''}) }}

And set it to your default value for _locale then it will not appear in the generated URL.