Skip to content
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

Implement a channel language filter. #12892

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

rtibbles
Copy link
Member

@rtibbles rtibbles commented Nov 27, 2024

Summary

  • Adds a filter for channel languages on the main Library page and each remote library browsing page
  • Populates the filter options only from the language property of the channel/root node metadata as the included_languages metadata currently only includes the language id and not the name.
  • When a language has not been specified (i.e. on first page load), the user is redirected to the language that is the closest match to their interface language. If none exists, no language is selected.
  • Displayed channels are displayed based on an exact match between the selected language and either their channel language, or their included languages property

Screenshot from 2024-11-27 13-43-49
Screenshot from 2024-11-27 13-42-04
Screenshot from 2024-11-27 13-40-42
Screenshot from 2024-11-27 13-40-32

References

Fixes #12702

Reviewer guidance

Open questions:

  • What, if any, effect should the channel language selection have on the 'language' selection for resource/folder search?
  • The language match can be very exact - for example in the first screenshot above where we only see two resources because that's what is in Castillian Spanish specificaly - because we mostly use language + region codes for our interface language, but our content languages are a mix of language and region codes, and just language codes. An alternative would be to do a less strict filtering, so we include all channels that are at least a language only match, so for example, if es-es is the selected language we would show:
    • First all the es-es channels
    • Then all the es channels
    • Then all the es-* channels

After updates:
Main open question is around how we are doing the filtering - currently, we use the fact that we are already fetching all the language metadata in the frontend to then send all relevant language codes to the backend in the API request.

This is a neat solution, but does mean we are adding an explicit chain step to our request waterfall - i.e. we have to wait until we've fetched the global search labels before we can fetch anything else.

The other alternative we could do there would be to instead just leverage the fact that we only really care about matching on the lang_code attribute - the part before the dash. We could add a new filter query to the API endpoint and then do matching on the backend against that.

In either case, we could potentially also still improve query performance here by making a language bitmask for the most frequently occurring languages, and annotate for quicker lookups - falling back to matching against the M2M included_languages when requesting languages not included in the bitmask.

@github-actions github-actions bot added APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: frontend labels Nov 27, 2024
@rtibbles rtibbles force-pushed the filter_your_language branch from c0db573 to bb22259 Compare November 27, 2024 23:28
@marcellamaki marcellamaki self-assigned this Dec 3, 2024
@rtibbles rtibbles marked this pull request as draft December 4, 2024 20:54
@rtibbles rtibbles force-pushed the filter_your_language branch from bb22259 to 1f5a9a4 Compare December 17, 2024 23:12
@github-actions github-actions bot added the DEV: backend Python, databases, networking, filesystem... label Dec 17, 2024
@rtibbles rtibbles force-pushed the filter_your_language branch from 1f5a9a4 to a468f6f Compare December 18, 2024 20:33
@rtibbles rtibbles force-pushed the filter_your_language branch from a468f6f to 5926cb1 Compare December 19, 2024 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: backend Python, databases, networking, filesystem... DEV: frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement language filter for channels
2 participants