I am using Silex and Twig for a website and I want to allow the user to change the langage of the site.
Right now, it works if I change the loca
The simple idea here is: how your application determines the language to be used to render the pages.
solution #1 (your current solution) based on a URL parameter (that's _locale ), and fallback to some default value in case no URL-parameter given.
So in this solution the translation component always looks for the selected language in the parameters bag prepared by the router component.
Solution #2 put your language identifier inside a session variable.
Your /new-langue page will have to set this session variable with the value it receives. and your router will populate the _locale parameter from that session variable.
I may be able to provide some code snippets a bit later.