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

Refactor manifesto initialization to push property localization down #3871

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

cbeer
Copy link
Collaborator

@cbeer cbeer commented Jan 10, 2024

From #3482:

A recent change in the Manifesto library made it possible to pass a list of languages (in descending order of preference) to the PropertyValue.getValue and PropertyValue.getValues methods, instead of relying on a single default locale that would be set when parsing the manifest. This allows for a better user experience, since we can now dynamically respond to changes in the user's language preferences without having to re-parse the manifest. Additionally, we can make use of the browser's language preferences to better match the user's language abilities.

This does the same thing as #3482, without introducing new redux state or a new selector parameter, in order to maintain API compatibility for downstream plugins. Instead, this PR:

  • introduces a LocaleContext and locale-context aware IIIFResourceLabel for rendering e.g. manifest, canvas, etc labels appropriately, replacing a lot of piece-meal label functions
  • ensures components within a companion window include that context when calling selectors (to get the getLocale/getManifestLocale to work right... this is somewhat unfortunate, but probably less weird if we started to use hooks or more extensive use of context like Use context to pass the window id around #3661 (and a companion-window equivalent))
  • Clean up styling for the companion window locale picker to make it more like the workspace language selector

This can be tested at https://deploy-preview-3871--mirador-dev.netlify.app/__tests__/integration/mirador/i18n.html

Fixes #3470

@codecov-commenter
Copy link

codecov-commenter commented Jan 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (593e81b) 92.53% compared to head (6933a52) 92.54%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3871   +/-   ##
=======================================
  Coverage   92.53%   92.54%           
=======================================
  Files         203      205    +2     
  Lines        3579     3582    +3     
=======================================
+ Hits         3312     3315    +3     
  Misses        267      267           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Base automatically changed from mui5 to master February 1, 2024 16:17
@cbeer cbeer marked this pull request as ready for review February 1, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multilingual manifest labels
3 participants