-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Controlled Vocabulary: Provide ability to store the id of a controlled vocabulary node and offer localized labels using cv.xml files per locale #9318
base: main
Are you sure you want to change the base?
Conversation
…er localized labels using cv.xml files per locale
Hi @mahnkong, |
Hi @mahnkong, |
4cae55b
to
97bb9e2
Compare
…pose is to find choices by label)
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.
Thank you @mahnkong, for adding this!
just merged latest main into feature branch and corrected errors due to new changes in DSpaceControlledVocabulary.java which required adjustments to be compatible to changes introduced in this feature branch |
References
Add references/links to any related issues or PRs. These may include:
Description
This PR fixes #9317. With this PR it is possible to use localized controlled vocabularies by having a controlled vocabulary file per locale (and fallback to english in case the current locale was not supported) Additionally, this PR provides the feature to store the id of a controlled vocabulary node instead of the label (configurable per controlled vocabulary)
Instructions for Reviewers
List of changes in this PR:
First, with this PR it is possible to use localized controlled vocabularies by having a controlled vocabulary file per locale (and fallback to english in case the current locale was not supported)
In order to support the localized controlled vocabularies, the init method of the class org.dspace.content.authority.DSpaceControlledVocabulary was enhanced to receive the current locale. (The public methods of that class already received the locale, so we simply pass the value to init) Inside the init method, a logic similar to DSpace6 was implemented. The method checks for existance of a file named
<CONTROLLED_VOCABULARY>_<LOCALE>.xml
- where<CONTROLLED_VOCABULARY>
is the name of the controlled vocabulary and<LOCALE>
is the current locale. If that file exists, it is used to contruct the controlled vocabulary. Otherwise, a fallback to the "standard" controlled vocabulary file<CONTROLLED_VOCABULARY>.xml
is made.Second, In order to support the optional storage of id instead of label value, a new configuration option per controlled vocabulary was introduced:
vocabulary.plugin.<CONTROLLED_VOCABULARY>.storeIDs
- where<CONTROLLED_VOCABULARY>
is the name of the controlled vocabulary. The class org.dspace.content.authority.DSpaceControlledVocabulary was enhanced to consider the new configuration option and use id attribute instead of label attribute when constructing the choice based on the xml node.Include guidance for how to test or review your PR. This may include: steps to reproduce a bug, screenshots or description of a new feature, or reasons behind specific changes.
The
DSpaceControlledVocabularyTest
test class was updated with test methods covering the PR changes. This, together with the change description above covers the configurations required to use the PR changes.Checklist
This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!
pom.xml
), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.