-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Filter carousels to appear in user's language #10691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @RedJade26 ! A few small tweaks.
Remove the public status of get_marc21_language as I am instead using convert_iso_to_marc (which is now marked as public)
for more information, see https://pre-commit.ci
Switched the user_lang_only parameters on the carousels on the homepage to True
Switched to convert_iso_to_marc
Switched to convert_iso_to_marc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, it's working for the solr-based carousels! A few small bugs/tweaks 👍
Co-authored-by: Drini Cami <[email protected]>
Co-authored-by: Drini Cami <[email protected]>
Moved the query logic up in the file
convert_iso_to_marc didn't seem to accept get_lang() or 'en' as an argument, It wanted a single string, so I moved that logic to the web_lang variable
convert_iso_to_marc didn't seem to accept get_lang() or 'en' as an argument, It wanted a single string, so I moved that logic to the web_lang variable
Otherwise carousels will appear largely empty. Longer term we want to give a UI control.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, lgtm! We ended up adding a limit to only filter if the language is in a list of many languages, because otherwise we were seeing a lot of empty carousels. Long term we want to create a UI option for this, though.
But otherwise, here's the homepage looking great in French!
Note a few of these carousels might look non-French, but it's actually this bug: #10742 .
Also CC @seabelis , in case this causes some patron confusion.
Issue #10562 is no longer blocked. This PR adds the functionality to filter a carousel based on the users language.
Closes #10562
This PR adds the functionality to filter a carousel based on the users language.
Technical
Right now, for all of the carousels, user_lang_only=False, but it gives the option to add this filter in the future.
I used the get_marc21_lang function as it took a 2 letter language abbreviation and makes it 3 letters (ex. en -> eng)
Testing
docker compose run --rm home make test
As mentioned in the issue, this is hard to test locally. However, I was able to test it locally by flipping user_lang_only=True in the QueryCarousel.html parameters in order to see the changes. Then I looked at the "you might also like" and "also by this author" carousels to see if it was filtering by language. Normally, without this change (or if user_lang_only= false) if I go to the "you might also like" carousel of Robinson Crusoe it suggests the German version of Alice in Wonderland. However, as the screenshots show, it no longer does that because the carousel is filtering on language.
Screenshot
Stakeholders
@cdrini