From 161be72bc4b342e38ab09fc68bd9f600e5d44182 Mon Sep 17 00:00:00 2001 From: joaquinvanschoren Date: Thu, 25 Jan 2024 23:58:36 +0100 Subject: [PATCH] Don't try to translate datasets and flows in filters --- app/public/locales/en/common.yml | 2 ++ app/src/components/search/Filter.js | 15 ++++++++++++--- app/src/pages/r/search.js | 2 ++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app/public/locales/en/common.yml b/app/public/locales/en/common.yml index cf28934..7654d96 100644 --- a/app/public/locales/en/common.yml +++ b/app/public/locales/en/common.yml @@ -722,6 +722,8 @@ filters: Weka: "Weka {{version}}" mlr: "MLR {{version}}" Moa: "Moa {{version}}" + dataset: "Dataset" + flow: "Flow" button: Croissant: "Croissant" XML: "XML" diff --git a/app/src/components/search/Filter.js b/app/src/components/search/Filter.js index 2dc7b72..92c2ffc 100644 --- a/app/src/components/search/Filter.js +++ b/app/src/components/search/Filter.js @@ -11,7 +11,7 @@ const FilterChip = styled(Chip)` `; // Handles special cases in the filter options -const processOption = (option) => { +const processOption = (option, translate = true) => { // Homogenize notation for library reporting and versioning const libraries = [ "sklearn", @@ -45,20 +45,29 @@ const processOption = (option) => { } else { return [`filters.${lib}`]; } - } else { + } else if (translate) { // If comma or newline separated, return the first const segments = option.split(/,|\n/); return [`filters.${segments[0]}`]; + } else { + return option; } }; const Filter = ({ label, options, values, onRemove, onSelect }) => { + // Don't invoke translation for flows or datasets + const translate = !["flow", "dataset"].includes(label.split(".").pop()); return ( {options.map((option) => (