mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
- The old method (link to `?locale=#{l.to_s}`) was not functional for path that already has query params in current path (such as `/user/spree_user/password/edit?reset_password_token=`) ;
- This seems that the best way to handle this, is to create a new route, new method that effectively set the lang (not the locale actually...) and then redirect_back (ie. using the HTTP_REFERER, with a fallback to `/`)
s
9 lines
226 B
Ruby
9 lines
226 B
Ruby
# frozen_string_literal: true
|
|
|
|
class LocalesController < BaseController
|
|
def show
|
|
UserLocaleSetter.new(spree_current_user, params[:id], cookies).set_locale
|
|
redirect_back fallback_location: main_app.root_url
|
|
end
|
|
end
|