Skip to content

Commit 067d416

Browse files
committed
make dataset types translatable and capitalized consisently #10517
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.
1 parent 57b410f commit 067d416

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java

+4
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,10 @@ public SolrQueryResponse search(
775775
}
776776
} else {
777777
try {
778+
// This is where facets are capitalized.
779+
// This will be a problem for the API clients because they get back a string like this from the Search API...
780+
// {"datasetType_s":{"friendly":"Dataset Type","labels":[{"Dataset":1},{"Software":1}]}
781+
// ... but they will need to use the lower case version (e.g. "software") to narrow results.
778782
localefriendlyName = BundleUtil.getStringFromPropertyFile(facetFieldCount.getName(), "Bundle");
779783
} catch (Exception e) {
780784
localefriendlyName = facetFieldCount.getName();

src/main/java/propertyFiles/Bundle.properties

+10
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@ newDataverse=New Dataverse
33
hostDataverse=Host Dataverse
44
dataverses=Dataverses
55
passwd=Password
6+
# BEGIN dataset types
7+
# `dataset=Dataset` has been here since 4.0 but now that we have dataset types,
8+
# we need to add the rest of the types here for two reasons. First, we want
9+
# translators to be able to translate these types. Second, in English it looks
10+
# weird to have only "Dataset" capitalized in the facet but not "software" and
11+
# "workflow". This capitalization (looking up here in the bundel) is done by
12+
# SearchServiceBean near the comment "This is where facets are capitalized".
613
dataset=Dataset
14+
software=Software
15+
workflow=Workflow
16+
# END dataset types
717
datasets=Datasets
818
newDataset=New Dataset
919
files=Files

0 commit comments

Comments
 (0)