diff --git a/backend/app/concerns/spree/admin/sets_user_language_locale_key.rb b/backend/app/concerns/spree/admin/sets_user_language_locale_key.rb new file mode 100644 index 00000000000..f8a156632b4 --- /dev/null +++ b/backend/app/concerns/spree/admin/sets_user_language_locale_key.rb @@ -0,0 +1,9 @@ +module Spree + module Admin + module SetsUserLanguageLocaleKey + def set_user_language_locale_key + :admin_locale + end + end + end +end diff --git a/backend/app/controllers/spree/admin/base_controller.rb b/backend/app/controllers/spree/admin/base_controller.rb index 51f74dfb77e..b72b7ea5b09 100644 --- a/backend/app/controllers/spree/admin/base_controller.rb +++ b/backend/app/controllers/spree/admin/base_controller.rb @@ -12,9 +12,7 @@ class BaseController < Spree::BaseController # Overrides ControllerHelpers::Common # We want the admin's locale selection to be different than that on the frontend - def set_user_language_locale_key - :admin_locale - end + include SetsUserLanguageLocaleKey def action params[:action].to_sym diff --git a/backend/app/controllers/spree/admin/locale_controller.rb b/backend/app/controllers/spree/admin/locale_controller.rb index c1d468d519f..59397f1916e 100644 --- a/backend/app/controllers/spree/admin/locale_controller.rb +++ b/backend/app/controllers/spree/admin/locale_controller.rb @@ -3,6 +3,8 @@ module Spree module Admin class LocaleController < Spree::Admin::BaseController + skip_before_action :authorize_admin, only: [:set] + def set requested_locale = params[:switch_to_locale].to_s.presence