Fix #4241 language selection#4805
Conversation
Consider the language set in the users profile when setting it on page load. Also match languages case-insensitive. Updated tests
…on-contribute-main
dbcf5d4 to
58b7b03
Compare
|
Hi @AbhinavS96, |
nwoodward
left a comment
There was a problem hiding this comment.
👍 Thanks @AbhinavS96! I tested this PR with all the given scenarios, and the language selection updated each time.
tdonohue
left a comment
There was a problem hiding this comment.
@AbhinavS96 : Maybe I'm misunderstanding the point of this PR, but I'm not able to change the language in my user profile and have it take affect in DSpace, even after logout.
Here's what I tried to do:
- Login as a user. Visit the user's "Profile" page (
/profile) - On that page, select a non-English language. I chose "Deutsch" (German)
- Click "Save" button on the Profile page.
- Logout
- Login again as that user. Verify the Profile still says "Deutsch". However, DSpace is not displaying German. Instead, it's still showing default English text.
Am I misunderstanding how this is supposed to act if a user changes their Language in their Profile?
|
@tdonohue: Did you try clearing your cookies? Currently on This means that the new order of importance for selecting the language is: By prioritizing the |
There was a problem hiding this comment.
👍 Thanks @AbhinavS96 ! And thank you for clarifying the expected behavior @alexandrevryghem ! I had previous misunderstood the order of precedence. But, I can now verify that the globe button (in header) has the highest precedence (via the dsLanguage cookie). But, if that cookie is unset, I can verify the language in the user profile has the next highest precedence. (So, my test above works if you unset the dsLanguage cookie.)
Code looks good too!
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin dspace-7_x
git worktree add -d .worktree/backport-4805-to-dspace-7_x origin/dspace-7_x
cd .worktree/backport-4805-to-dspace-7_x
git switch --create backport-4805-to-dspace-7_x
git cherry-pick -x 7da01d80d810d0da5668ef045001b9a73711b300 58b7b03d19bbc02d4d42c24a2062538a410582d9 |
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin dspace-8_x
git worktree add -d .worktree/backport-4805-to-dspace-8_x origin/dspace-8_x
cd .worktree/backport-4805-to-dspace-8_x
git switch --create backport-4805-to-dspace-8_x
git cherry-pick -x 7da01d80d810d0da5668ef045001b9a73711b300 58b7b03d19bbc02d4d42c24a2062538a410582d9 |
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin dspace-9_x
git worktree add -d .worktree/backport-4805-to-dspace-9_x origin/dspace-9_x
cd .worktree/backport-4805-to-dspace-9_x
git switch --create backport-4805-to-dspace-9_x
git cherry-pick -x 7da01d80d810d0da5668ef045001b9a73711b300 58b7b03d19bbc02d4d42c24a2062538a410582d9 |

References
Description
This fixes an issue where the language set in the user's profile was not being applied. It also addresses a problem where the default browser language was sometimes ignored. Portuguese (Portugal) (
pt-PT) and Portuguese (Brazil) (pt-BR) will now be correctly used when defined in the browser's language settings. I also fixed the issue where only the first browser language was ever considered.NOTE: The behavior of the language cookie was changed. It will now only be saved if the user manually selects a language using the language switch. Otherwise, the language will be inferred from the browser settings or the EPerson’s profile.
Instructions for Reviewers
List of changes in this PR:
To test:
Checklist
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.