From 067d41654b52c486d303c590cfcd483224847feb Mon Sep 17 00:00:00 2001 From: Philip Durbin Date: Mon, 29 Jul 2024 14:54:24 -0400 Subject: [PATCH] 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. --- .../harvard/iq/dataverse/search/SearchServiceBean.java | 4 ++++ src/main/java/propertyFiles/Bundle.properties | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java index cda7c53a9e5..bc24eb949b4 100644 --- a/src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/search/SearchServiceBean.java @@ -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(); diff --git a/src/main/java/propertyFiles/Bundle.properties b/src/main/java/propertyFiles/Bundle.properties index 4b366522966..76374edb07e 100644 --- a/src/main/java/propertyFiles/Bundle.properties +++ b/src/main/java/propertyFiles/Bundle.properties @@ -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