fix(i18n): add lowercase keys for selected search facets (#5048)#5052
Draft
JohnnyMendesC wants to merge 1 commit intoDSpace:mainfrom
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
References
Description
This PR fixes a bug where selected search facets (e.g., "Workspace", "Workflow", "Archived") displayed raw, untranslated values due to a case sensitivity mismatch between URL parameters (lowercase) and i18n keys (TitleCase). It adds the necessary lowercase translation keys to
en.json5andpt-BR.json5to ensure correct display without introducing regressions in other filter types.Instructions for Reviewers
Context and Analysis:
The issue stems from the fact that DSpace uses different casing for the same concept depending on the context:
f.namedresourcetype=workspaceoritem).Why this approach?
I investigated fixing this via a code change (capitalizing the selected value in
search-facet-selected-option.component.ts), but this caused regressions:true/falsein the URL. Capitalizing them toTruebroke the lookup against existing lowercase keys (search.filters.withdrawn.true), displaying raw "true" instead of "Yes".open.access) were incorrectly capitalized toOpen.access, displaying raw "open.access" instead of "Open Access".Renaming the existing TitleCase keys to lowercase was also ruled out, as it breaks the translation of the unselected sidebar list returned by Solr.
Solution:
The safest and most robust solution implemented here is to add the lowercase variants of the keys to the translation files. This supports the URL parameters while keeping the existing keys for Solr responses.
List of changes in this PR:
workflow,workspace, anditem(mapped to "Archived") insrc/assets/i18n/en.json5.src/assets/i18n/pt-BR.json5.How to test:
/admin/workflowor/admin/search.Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
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.