Skip to content

Commit 2a6ca76

Browse files
committed
Fix inconsistence between the locale on the backend and the locale in the devise's backend controllers
NOTE: ::Spree::Admin::SetsUserLanguageLocaleKey concern added in Solidus 3.2, so as soon as this gem stops supporting Solidus versions < 3.2 this "if" should be replaced with simple include
1 parent 094e93e commit 2a6ca76

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

lib/controllers/backend/spree/admin/user_passwords_controller.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,15 @@ def update
4242
super
4343
end
4444
end
45+
46+
private
47+
48+
# NOTE: as soon as this gem stops supporting Solidus 3.1 if-else should be removed and left only include
49+
if defined?(::Spree::Admin::SetsUserLanguageLocaleKey)
50+
include ::Spree::Admin::SetsUserLanguageLocaleKey
51+
else
52+
def set_user_language_locale_key
53+
:admin_locale
54+
end
55+
end
4556
end

lib/controllers/backend/spree/admin/user_sessions_controller.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ def authorization_failure
3535

3636
private
3737

38+
# NOTE: as soon as this gem stops supporting Solidus 3.1 if-else should be removed and left only include
39+
if defined?(::Spree::Admin::SetsUserLanguageLocaleKey)
40+
include ::Spree::Admin::SetsUserLanguageLocaleKey
41+
else
42+
def set_user_language_locale_key
43+
:admin_locale
44+
end
45+
end
46+
3847
def accurate_title
3948
I18n.t('spree.login')
4049
end

0 commit comments

Comments
 (0)