Provide support to fix locale selection in admin login page #4493
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Expected behavior
Given I am running a Solidus app with Solidus I18n (see https://github.com/gsmendoza/rails_7_store/tree/solidus_30253731078c_3_2_0_alpha_solidus_i18n)
And I am in the admin login page
When I change the locale in the locale selector (e.g. to Espanol MX)
Then I should see the locale change on the login page
Actual behavior
The "Loading" popup window appears but nothing happens.
In the backend, a PUT request is submitted to "/admin/locale/set" but the request is redirected to the login page, e.g.
If you try to log in afterwards, you are redirected to http://localhost:3000/admin/locale/set with the following error:
Causes
set_user_language_locale_key
is not set to:admin_locale
.Background
solidusio/solidus_auth_devise#224 was submitted to fix the second cause of the bug:
set_user_language_locale_key
not being set to:admin_locale
. Based on the discussions in the PR, we decided to update Solidus in two ways:SetsUserLanguageLocaleKey
so that Fix locale inconsistence and remove redundant template solidus_auth_devise#224 won't have to refer to:admin_locale
key directly.Fix Demo
Tested manually with this Rails app: https://github.com/gsmendoza/rails_7_store/tree/gsmendoza/eng-436-changing-the-locale-in-the-admin-login.
The Rails app includes this corresponding fix for SolidusAuthDevise: https://github.com/gsmendoza/solidus_auth_devise/tree/gsmendoza/eng-436-changing-the-locale-in-the-admin-login.
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed (
cross them outif they are not):[ ] I have added automated tests to cover my changes.[ ] I have attached screenshots to demo visual changes.[ ] I have opened a PR to update the guides.[ ] I have updated the readme to account for my changes.