Skip to content

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

Merged
merged 15 commits into from
May 12, 2025

Conversation

RedJade26
Copy link
Contributor

@RedJade26 RedJade26 commented Apr 16, 2025

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

Carousel

Stakeholders

@cdrini

@github-actions github-actions bot added the Priority: 2 Important, as time permits. [managed] label Apr 16, 2025
Copy link
Collaborator

@cdrini cdrini left a 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.

@cdrini cdrini added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Apr 24, 2025
Remove the public status of get_marc21_language as I am instead using convert_iso_to_marc (which is now marked as public)
@github-actions github-actions bot removed the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label May 5, 2025
pre-commit-ci bot and others added 4 commits May 5, 2025 19:27
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
Copy link
Collaborator

@cdrini cdrini left a 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 👍

@cdrini cdrini added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label May 8, 2025
@github-actions github-actions bot removed the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label May 9, 2025
RedJade26 added 3 commits May 9, 2025 11:00
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
@cdrini cdrini changed the title language_filter for carousels Filter carousels to appear in user's language May 12, 2025
Copy link
Collaborator

@cdrini cdrini left a 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!

image

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.

@cdrini cdrini merged commit eb8da9e into internetarchive:master May 12, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 2 Important, as time permits. [managed]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add new user_lang_only=False option to QueryCarousel, custom_ia_carousel + use on homepage
2 participants