From 94e0925ebfd841105a808f5c6a3f2fd741d314a7 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Mon, 23 Oct 2023 11:20:32 -0400 Subject: [PATCH] Remove all usage of localize filter, use either directive or local computeds --- .../components/ActivityBar/ActivityItem.vue | 12 +++++- client/src/components/Annotation.vue | 11 ++++- client/src/components/Common/DelayedInput.vue | 13 +++++- .../DatasetInformation/DatasetAttributes.vue | 43 +++++++++++++------ .../DatasetInformation/DatasetError.vue | 8 +++- client/src/components/Form/FormGeneric.vue | 10 ++++- client/src/components/Form/FormMessage.vue | 9 +++- .../History/CurrentHistory/HistoryEmpty.vue | 11 ++++- .../CurrentHistory/HistoryMessages.vue | 14 +++--- .../History/HistoryPublishedList.vue | 8 +++- .../components/History/Modals/CopyModal.vue | 5 ++- client/src/components/Indices/IndexFilter.vue | 9 +++- .../components/Indices/SharingIndicators.vue | 17 ++++++-- client/src/components/LoadingSpan.vue | 4 +- .../NewUserWelcome/components/Slides.vue | 4 +- .../NewUserWelcome/components/Subtopics.vue | 10 ++--- .../NewUserWelcome/components/Topics.vue | 10 ++--- .../ObjectStore/SelectObjectStore.vue | 2 +- .../ObjectStore/ShowSelectedObjectStore.vue | 11 +++-- .../src/components/Page/PageIndexActions.vue | 4 +- client/src/components/Page/PageList.vue | 13 ++++-- client/src/components/Upload/UploadButton.vue | 12 +++++- .../Quota/ProvidedQuotaSourceUsageBar.vue | 2 +- .../Workflow/Editor/LintSection.vue | 2 +- .../BioComputeObjectExportCard.vue | 2 +- .../Plugins/BioComputeObject/SendForm.vue | 2 +- .../Workflow/WorkflowIndexActions.vue | 6 ++- .../components/Workflow/WorkflowRunButton.vue | 6 ++- client/src/components/plugins/localization.js | 2 - 29 files changed, 193 insertions(+), 69 deletions(-) diff --git a/client/src/components/ActivityBar/ActivityItem.vue b/client/src/components/ActivityBar/ActivityItem.vue index c6ce2a2ee75b..0988f4f0909f 100644 --- a/client/src/components/ActivityBar/ActivityItem.vue +++ b/client/src/components/ActivityBar/ActivityItem.vue @@ -5,6 +5,7 @@ import { useRouter } from "vue-router/composables"; import TextShort from "@/components/Common/TextShort.vue"; import Popper from "@/components/Popper/Popper.vue"; +import { localize } from "@/utils/localization"; const router = useRouter(); interface Option { @@ -43,6 +44,13 @@ const emit = defineEmits<{ (e: "click"): void; }>(); +const localized = computed(() => { + return { + tooltip: localize(props.tooltip), + title: localize(props.title), + }; +}); + function onClick(evt: MouseEvent): void { emit("click"); if (props.to) { @@ -58,7 +66,7 @@ function onClick(evt: MouseEvent): void { + :aria-label="localized.title">
- {{ tooltip | l }} + {{ localized.tooltip }} No tooltip available for this item @@ -49,6 +49,7 @@ import { mapActions, mapState } from "pinia"; import { useHistoryStore } from "@/stores/historyStore"; import { useUserStore } from "@/stores/userStore"; +import { localize } from "@/utils/localization"; export default { props: { @@ -67,7 +68,7 @@ export default { return `Copying History: ${this.history.name}`; }, saveTitle() { - return this.loading ? "Saving..." : "Copy History"; + return localize(this.loading ? "Saving..." : "Copy History"); }, saveVariant() { return this.loading ? "info" : this.formValid ? "primary" : "secondary"; diff --git a/client/src/components/Indices/IndexFilter.vue b/client/src/components/Indices/IndexFilter.vue index 94ce4cc5b645..65be5243e511 100644 --- a/client/src/components/Indices/IndexFilter.vue +++ b/client/src/components/Indices/IndexFilter.vue @@ -7,7 +7,7 @@ name="query" :value="debouncedValue" autocomplete="off" - :placeholder="placeholder | localize" + :placeholder="localized.placeholder" data-description="filter index input" class="search-query index-filter-query" :size="size" @@ -92,6 +92,13 @@ export default { localFilter: this.value, }; }, + computed: { + localized() { + return { + placeholder: this.placeholder, + }; + }, + }, watch: { value(newValue) { this.localFilter = newValue; diff --git a/client/src/components/Indices/SharingIndicators.vue b/client/src/components/Indices/SharingIndicators.vue index b2f1cd3fdae2..61eb9ef211dc 100644 --- a/client/src/components/Indices/SharingIndicators.vue +++ b/client/src/components/Indices/SharingIndicators.vue @@ -3,6 +3,9 @@ import { library } from "@fortawesome/fontawesome-svg-core"; import { faGlobe, faLink, faShareAlt } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; import { BButton, VBTooltip } from "bootstrap-vue"; +import { computed } from "vue"; + +import { localize } from "@/utils/localization"; library.add(faGlobe, faShareAlt, faLink); @@ -10,6 +13,14 @@ interface SharingIndicatorsProps { object: Object; } const props = defineProps(); + +const localized = computed(() => { + return { + findPublished: localize("Find all published items"), + findImportable: localize("Find all importable items"), + findShared: localize("Find all items shared with me"), + }; +}); diff --git a/client/src/components/Workflow/WorkflowRunButton.vue b/client/src/components/Workflow/WorkflowRunButton.vue index 08d0c81ad492..c9088e39856b 100644 --- a/client/src/components/Workflow/WorkflowRunButton.vue +++ b/client/src/components/Workflow/WorkflowRunButton.vue @@ -1,7 +1,7 @@