Skip to content

Commit a2a0190

Browse files
authored
Merge pull request #21710 from jianzuoyi/feature-dev-nls
Enhancement: multi-language support for international users
2 parents 388be51 + 06b1d6b commit a2a0190

37 files changed

+198
-136
lines changed

client/src/components/ActivityBar/ActivityBar.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import type { Activity } from "@/stores/activityStoreTypes";
1414
import { useEventStore } from "@/stores/eventStore";
1515
import { useUnprivilegedToolStore } from "@/stores/unprivilegedToolStore";
1616
import { useUserStore } from "@/stores/userStore";
17+
import localize from "@/utils/localization";
1718
1819
import InvocationsPanel from "../Panels/InvocationsPanel.vue";
1920
import ActivityItem from "./ActivityItem.vue";
@@ -363,8 +364,8 @@ defineExpose({
363364
<SettingsPanel
364365
v-else-if="isActiveSideBar('settings')"
365366
:activity-bar-id="props.activityBarId"
366-
:heading="props.optionsHeading"
367-
:search-placeholder="props.optionsSearchPlaceholder"
367+
:heading="localize(props.optionsHeading)"
368+
:search-placeholder="localize(props.optionsSearchPlaceholder)"
368369
@activityClicked="(id) => emit('activityClicked', id)" />
369370
<AdminPanel v-else-if="isActiveSideBar('admin')" />
370371
<slot name="side-panel" :is-active-side-bar="isActiveSideBar"></slot>

client/src/components/ActivityBar/ActivityItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const meta = computed(() => store.metaForId(props.id));
9494
</span>
9595
<FontAwesomeIcon :icon="icon" />
9696
</div>
97-
<TextShort v-if="title" :text="title" class="nav-title" />
97+
<TextShort v-if="title" :text="localize(title)" class="nav-title" />
9898
</b-nav-item>
9999
</template>
100100
<div class="text-center px-2 py-1">

client/src/components/Form/Elements/FormBoolean.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ const label = computed(() => (currentValue.value ? "Yes" : "No"));
2525

2626
<template>
2727
<b-form-checkbox v-model="currentValue" class="no-highlight" switch>
28-
<span v-if="!props.noLabel">{{ label }}</span>
28+
<span v-if="!props.noLabel" v-localize>{{ label }}</span>
2929
</b-form-checkbox>
3030
</template>

client/src/components/Form/Elements/FormData/FormDataContextButtons.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
COLLECTION_TYPE_TO_LABEL,
1111
type CollectionBuilderType,
1212
} from "@/components/Collections/common/buildCollectionModal";
13+
import localize from "@/utils/localization";
1314
import { capitalizeFirstLetter } from "@/utils/strings";
1415
1516
import { buildersForCollectionTypes, unconstrainedCollectionTypeBuilders } from "./collections";
@@ -89,7 +90,7 @@ const defaultCollectionBuilderType = computed<CollectionBuilderType>(() => {
8990
:key="index"
9091
v-b-tooltip.hover.bottom
9192
:pressed="props.currentField === index"
92-
:title="v.tooltip"
93+
:title="localize(v.tooltip)"
9394
:style="v.icon === faFolder && v.multiple ? 'padding: 2px' : ''"
9495
@click="emit('set-current-field', index)">
9596
<span v-if="v.icon === faFolder && v.multiple" class="fa-stack" style="height: unset">
@@ -101,7 +102,7 @@ const defaultCollectionBuilderType = computed<CollectionBuilderType>(() => {
101102
<BButton
102103
v-if="props.canBrowse && !props.workflowRun"
103104
v-b-tooltip.hover.bottom
104-
title="Browse or Upload Datasets"
105+
:title="localize('Browse or Upload Datasets')"
105106
@click="emit('on-browse')">
106107
<FontAwesomeIcon v-if="props.loading" :icon="faSpinner" spin />
107108
<span v-else class="font-weight-bold">...</span>

client/src/components/Form/FormInputs.vue

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
:class="{ 'bordered-input': syncWithGraph && activeNodeId === index }">
77
<div v-if="input.type == 'conditional'" class="ui-portlet-section mt-3">
88
<div class="portlet-header">
9-
<b>{{ input.test_param.label || input.test_param.name }}</b>
9+
<b v-localize>{{ input.test_param.label || input.test_param.name }}</b>
1010
</div>
1111
<div class="portlet-content">
1212
<FormElement
1313
:id="conditionalPrefix(input, input.test_param.name)"
1414
v-model="input.test_param.value"
1515
:type="input.test_param.type"
16-
:help="input.test_param.help"
16+
:help="localize(input.test_param.help)"
1717
:help-format="input.test_param.help_format"
1818
:refresh-on-change="false"
1919
:disabled="sustainConditionals"
@@ -39,9 +39,14 @@
3939
@swap="(a, b) => repeatSwap(input, a, b)" />
4040
</div>
4141
<div v-else-if="input.type == 'section'">
42-
<FormCard :title="input.title || input.name" :expanded.sync="input.expanded" :collapsible="true">
42+
<FormCard
43+
:title="localize(input.title || input.name)"
44+
:expanded.sync="input.expanded"
45+
:collapsible="true">
4346
<template v-slot:body>
44-
<div v-if="input.help" class="my-2" data-description="section help">{{ input.help }}</div>
47+
<div v-if="input.help" class="my-2" data-description="section help">
48+
{{ localize(input.help) }}
49+
</div>
4550
<FormNode v-bind="$props" :inputs="input.inputs" :prefix="getPrefix(input.name)" />
4651
</template>
4752
</FormCard>
@@ -50,11 +55,11 @@
5055
v-else
5156
:id="getPrefix(input.name)"
5257
v-model="input.value"
53-
:title="input.label || input.name"
58+
:title="localize(input.label || input.name)"
5459
:type="input.type"
5560
:error="input.error"
5661
:warning="input.warning"
57-
:help="input.help"
62+
:help="localize(input.help)"
5863
:help-format="input.help_format"
5964
:refresh-on-change="input.refresh_on_change"
6065
:attributes="input.attributes || input"

client/src/components/Form/FormRepeat.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,10 @@ const { keyObject } = useKeyedObjects();
114114
<template>
115115
<div>
116116
<div v-if="!props.sustainRepeats || props.input.cache?.length > 0">
117-
<div class="font-weight-bold mb-2">{{ props.input.title }}</div>
118-
<div v-if="props.input.help" class="mb-2" data-description="repeat help">{{ props.input.help }}</div>
117+
<div class="font-weight-bold mb-2">{{ localize(props.input.title) }}</div>
118+
<div v-if="props.input.help" class="mb-2" data-description="repeat help">
119+
{{ localize(props.input.help) }}
120+
</div>
119121
</div>
120122

121123
<FormCard

client/src/components/History/Content/ContentOptions.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { computed, type Ref, ref } from "vue";
1818
1919
import { getAppRoot } from "@/onload/loadConfig";
2020
import { useEntryPointStore } from "@/stores/entryPointStore";
21+
import localize from "@/utils/localization";
2122
import { prependPath } from "@/utils/redirect";
2223
2324
const props = defineProps({
@@ -112,7 +113,7 @@ function onDisplay($event: MouseEvent) {
112113
v-if="isCollection && canShowCollectionDetails"
113114
v-b-tooltip.hover
114115
class="collection-job-details-btn px-1"
115-
title="Show Details"
116+
:title="localize('Show Details')"
116117
size="sm"
117118
variant="link"
118119
:href="showCollectionDetailsUrl"
@@ -123,7 +124,7 @@ function onDisplay($event: MouseEvent) {
123124
<BButton
124125
v-if="isDataset"
125126
v-b-tooltip.hover
126-
title="View"
127+
:title="localize('View')"
127128
tabindex="0"
128129
class="display-btn px-1"
129130
size="sm"
@@ -136,7 +137,7 @@ function onDisplay($event: MouseEvent) {
136137
v-if="writable && isHistoryItem"
137138
v-b-tooltip.hover
138139
:disabled="editDisabled"
139-
:title="editButtonTitle"
140+
:title="localize(editButtonTitle)"
140141
tabindex="0"
141142
class="edit-btn px-1"
142143
size="sm"
@@ -149,7 +150,7 @@ function onDisplay($event: MouseEvent) {
149150
v-if="isRunningInteractiveTool"
150151
v-b-tooltip.hover
151152
class="delete-btn px-1"
152-
title="Stop this Interactive Tool"
153+
:title="localize('Stop this Interactive Tool')"
153154
size="sm"
154155
variant="link"
155156
@click.stop="onDelete($event)">
@@ -160,7 +161,7 @@ function onDisplay($event: MouseEvent) {
160161
v-b-tooltip.hover
161162
:tabindex="isDataset ? '0' : '-1'"
162163
class="delete-btn px-1"
163-
title="Delete"
164+
:title="localize('Delete')"
164165
size="sm"
165166
variant="link"
166167
@click.stop="onDelete($event)">
@@ -184,7 +185,7 @@ function onDisplay($event: MouseEvent) {
184185
v-b-tooltip.hover
185186
tabindex="0"
186187
class="undelete-btn px-1"
187-
title="Undelete"
188+
:title="localize('Undelete')"
188189
size="sm"
189190
variant="link"
190191
@click.stop="emit('undelete')">
@@ -195,7 +196,7 @@ function onDisplay($event: MouseEvent) {
195196
v-b-tooltip.hover
196197
tabindex="0"
197198
class="unhide-btn px-1"
198-
title="Unhide"
199+
:title="localize('Unhide')"
199200
size="sm"
200201
variant="link"
201202
@click.stop="emit('unhide')">

client/src/components/History/CurrentHistory/HistoryCounter.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { type HistorySummaryExtended, userOwnsHistory } from "@/api";
1313
import { HistoryFilters } from "@/components/History/HistoryFilters.js";
1414
import { useHistoryContentStats } from "@/composables/historyContentStats";
1515
import { useUserStore } from "@/stores/userStore";
16+
import localize from "@/utils/localization";
1617
1718
import GButton from "@/components/BaseComponents/GButton.vue";
1819
@@ -116,7 +117,7 @@ onMounted(() => {
116117
<div class="history-size my-1 d-flex justify-content-between">
117118
<GButton
118119
tooltip
119-
title="History Size"
120+
:title="localize('History Size')"
120121
transparent
121122
size="small"
122123
color="blue"
@@ -132,7 +133,7 @@ onMounted(() => {
132133
<BButtonGroup>
133134
<BButton
134135
v-b-tooltip.hover
135-
title="Show active"
136+
:title="localize('Show active')"
136137
variant="link"
137138
size="sm"
138139
class="rounded-0 text-decoration-none"
@@ -145,7 +146,7 @@ onMounted(() => {
145146
<BButton
146147
v-if="numItemsDeleted"
147148
v-b-tooltip.hover
148-
title="Include deleted"
149+
:title="localize('Include deleted')"
149150
variant="link"
150151
size="sm"
151152
class="rounded-0 text-decoration-none"
@@ -159,7 +160,7 @@ onMounted(() => {
159160
<BButton
160161
v-if="numItemsHidden"
161162
v-b-tooltip.hover
162-
title="Include hidden"
163+
:title="localize('Include hidden')"
163164
variant="link"
164165
size="sm"
165166
class="rounded-0 text-decoration-none"

client/src/components/History/CurrentHistory/HistoryNavigation.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function userTitle(title: string) {
5252
aria-label="current history management">
5353
<GButton v-if="!props.minimal" size="small" transparent @click="emit('show', false)">
5454
<FontAwesomeIcon fixed-width :icon="faChevronRight" />
55-
<span>History</span>
55+
<span v-localize>History</span>
5656
</GButton>
5757

5858
<BButtonGroup>

client/src/components/History/CurrentHistory/HistoryOperations/HistoryOperations.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { faCheckSquare, faCompress } from "@fortawesome/free-solid-svg-icons";
33
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
44
55
import type { HistorySummaryExtended } from "@/api";
6+
import localize from "@/utils/localization";
67
78
import DefaultOperations from "@/components/History/CurrentHistory/HistoryOperations/DefaultOperations.vue";
89
@@ -34,7 +35,7 @@ function onUpdateOperationStatus(updateTime: number) {
3435
<BButtonGroup>
3536
<BButton
3637
v-b-tooltip.hover
37-
title="Select Items"
38+
:title="localize('Select Items')"
3839
class="show-history-content-selectors-btn rounded-0"
3940
size="sm"
4041
variant="link"
@@ -46,7 +47,7 @@ function onUpdateOperationStatus(updateTime: number) {
4647

4748
<BButton
4849
v-b-tooltip.hover
49-
title="Collapse Items"
50+
:title="localize('Collapse Items')"
5051
class="rounded-0"
5152
size="sm"
5253
variant="link"
@@ -69,7 +70,7 @@ function onUpdateOperationStatus(updateTime: number) {
6970
<nav v-else-if="isMultiViewItem" class="content-operations bg-secondary">
7071
<BButton
7172
v-b-tooltip.hover
72-
title="Collapse Items"
73+
:title="localize('Collapse Items')"
7374
class="rounded-0"
7475
size="sm"
7576
variant="link"

0 commit comments

Comments
 (0)