Fix human-readable publication relation type labels - #1048
Fix human-readable publication relation type labels#1048youseihuayu-wonderful wants to merge 4 commits into
Conversation
ChengShi-1
left a comment
There was a problem hiding this comment.
Hi Sy, thanks for your contribution! I left some comments here. The main concern is the hard-coded string, which could be made dynamic to support internationalization.
|
@ChengShi-1 Thanks for the review. I addressed all comments which passed on immediate isolated rerun (38/38). Could you please take another look? |
| 'References' | ||
| ] as const | ||
|
|
||
| export function getPublicationRelationLabel(value: string, t: TFunction): string { |
There was a problem hiding this comment.
Sorry I didn't mention it from last review. After another look, I think the way we get the label is not to create a helper like this. The usual pattern in this codebase is to translate the value directly in the component.
We could remove this function by adding the follwing to Vocabulary.tsx, so we wouldn't need to pass the helper function through multiple files.
label: name === PUBLICATION_RELATION_TYPE_FIELD_NAME && PUBLICATION_RELATION_TYPE_VALUES.some((value) => value === option) ? t(publicationRelationTypes.${option}) : option
MetadataBlockInfo.spec.ts and some related tests should be removed as well.
Before you push the commit, don't forget to run npx prettier --write . to automatically fix format error
Problem
The modern UI uses raw controlled-vocabulary values as display labels for
publicationRelationType. This causes values such asIsSupplementedBytoappear instead of the human-readable
Is Supplemented By.Implementation
types.
{ value, label }options in the dataset metadata edit form.view.
Backward compatibility
This is a presentation-only change. Form submissions, stored metadata, API
values, and DataCite-compatible values continue to use the original raw values
such as
IsSupplementedBy.Existing datasets receive the corrected labels at render time without migration,
reindexing, or resaving.
Validation
Closes #1041