I have a navigation bar with links to different languages:
<%= link_to t('header.english'), locale: "en" %>
The problem is that the user is trying to switch the language on the page that contains additional parameters in the URL. Changing the language at this point reloads the page and breaks all the additional parameters.
So, how to transfer all parameters from the current page to the local switch link?
For example, when
/page/new?param1=1¶m2=2
open, and the user switches the locale,
/page/new?locale=en
opens and both optional parameters are removed from the URL.
source share