Dynamic Routs.path

Hello there, I have drop-down menu in my app header to choose language in my app. And using Routes.page_path(conn, :index, locale: locale) I change the language, however if I click on any language it gets me back to page.index.html. So I’m asking is there a way to make this link dynamic like a function in path helpers that reloads the same route with the language without going to page.index.html template.
Thanks in advance!

I am using links with these to…

to: "?locale=#{locale}"

It will redirect to self with additional locale.


I doesn’t work for me. Are you using set_locale plug?

No, I followed this

and this

1 Like