I have set up and used set_locale: 0.2.8
, Can anyone help me to reload the same route with the new locale?
You want to redirect /en/some
to /fr/some
? Can you not just fetch the locale from your params, if you followed the set_locale
readme that would be just ‘locale’, and then just redirect?
# inside some_controller.ex
def my_route(conn, %{"locale" => "en"}) do
redirect(conn, to: Router.my_route_path(conn, locale: "fr"))
end
def my_route(conn, %{"locale" => _}) do
# no redirect here, just render
render()
end
1 Like
Yeah, I’ve already tried it and it worked. Thank you so much tho.