Skip to content

Commit

Permalink
Merge pull request #4493 from gsmendoza/gsmendoza/eng-436-changing-th…
Browse files Browse the repository at this point in the history
…e-locale-in-the-admin-login

Provide support to fix locale selection in admin login page
  • Loading branch information
waiting-for-dev authored Aug 8, 2022
2 parents 3025373 + d18443f commit 4e9b6f3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Spree
module Admin
module SetsUserLanguageLocaleKey
def set_user_language_locale_key
:admin_locale
end
end
end
end
4 changes: 1 addition & 3 deletions backend/app/controllers/spree/admin/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions backend/app/controllers/spree/admin/locale_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 4e9b6f3

Please sign in to comment.