Skip to content

Commit

Permalink
Use a different session key for admin locale
Browse files Browse the repository at this point in the history
  • Loading branch information
jhawthorn authored and John Hawthorn committed May 16, 2018
1 parent bcc3e95 commit d016d29
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions backend/app/controllers/spree/admin/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ class BaseController < Spree::BaseController

private

# 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

def action
params[:action].to_sym
end
Expand Down
6 changes: 5 additions & 1 deletion core/lib/spree/core/controller_helpers/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ def accurate_title

private

def set_user_language_locale_key
:locale
end

def set_user_language
available_locales = Spree.i18n_available_locales
locale = [
params[:locale],
session[:locale],
session[set_user_language_locale_key],
(config_locale if respond_to?(:config_locale, true)),
I18n.default_locale
].detect do |candidate|
Expand Down

0 comments on commit d016d29

Please sign in to comment.