Skip to content

Commit

Permalink
make dataset types translatable and capitalized consisently #10517
Browse files Browse the repository at this point in the history
Before this commit, the facet looked like this...

Dataset Type
(3) Dataset
(2) software
(1) workflow

... that is, "Dataset" was capitalized but "sofware" and
"workflow" were not. This commit fixes this, making all types
capitalized, and it makes the values translatable in other
languages. However, it does nothing to address some confusion
that Search API users will feel. They'll get back the capitalized
values but will need to pass in the lower case version (in English)
to narrow their search results.
  • Loading branch information
pdurbin committed Jul 29, 2024
1 parent 57b410f commit 067d416
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,10 @@ public SolrQueryResponse search(
}
} else {
try {
// This is where facets are capitalized.
// This will be a problem for the API clients because they get back a string like this from the Search API...
// {"datasetType_s":{"friendly":"Dataset Type","labels":[{"Dataset":1},{"Software":1}]}
// ... but they will need to use the lower case version (e.g. "software") to narrow results.
localefriendlyName = BundleUtil.getStringFromPropertyFile(facetFieldCount.getName(), "Bundle");
} catch (Exception e) {
localefriendlyName = facetFieldCount.getName();
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/propertyFiles/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@ newDataverse=New Dataverse
hostDataverse=Host Dataverse
dataverses=Dataverses
passwd=Password
# BEGIN dataset types
# `dataset=Dataset` has been here since 4.0 but now that we have dataset types,
# we need to add the rest of the types here for two reasons. First, we want
# translators to be able to translate these types. Second, in English it looks
# weird to have only "Dataset" capitalized in the facet but not "software" and
# "workflow". This capitalization (looking up here in the bundel) is done by
# SearchServiceBean near the comment "This is where facets are capitalized".
dataset=Dataset
software=Software
workflow=Workflow
# END dataset types
datasets=Datasets
newDataset=New Dataset
files=Files
Expand Down

0 comments on commit 067d416

Please sign in to comment.