Skip to content

Commit eca33e4

Browse files
feat: i18n
1 parent 765c24d commit eca33e4

File tree

29 files changed

+135
-78
lines changed

29 files changed

+135
-78
lines changed

ui/src/components/ai-chat/ExecutionDetailDialog.vue

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@
6868
<span class="color-secondary">{{ f.label }}:</span> {{ f.value }}
6969
</div>
7070
<div v-if="item.document_list?.length > 0">
71-
<p class="mb-8 color-secondary">文档:</p>
71+
<p class="mb-8 color-secondary">
72+
{{ $t('common.fileUpload.document') }}:
73+
</p>
7274

7375
<el-space wrap>
7476
<template v-for="(f, i) in item.document_list" :key="i">
@@ -88,7 +90,7 @@
8890
</el-space>
8991
</div>
9092
<div v-if="item.image_list?.length > 0">
91-
<p class="mb-8 color-secondary">图片:</p>
93+
<p class="mb-8 color-secondary">{{ $t('common.fileUpload.image') }}:</p>
9294

9395
<el-space wrap>
9496
<template v-for="(f, i) in item.image_list" :key="i">
@@ -165,7 +167,10 @@
165167
class="card-never border-r-4"
166168
v-if="item.type !== WorkflowType.Application"
167169
>
168-
<h5 class="p-8-12">角色设定 (System)</h5>
170+
<h5 class="p-8-12">
171+
{{ $t('views.application.applicationForm.form.roleSettings.label') }}
172+
(System)
173+
</h5>
169174
<div class="p-8-12 border-t-dashed lighter">
170175
{{ item.system || '-' }}
171176
</div>
@@ -174,7 +179,7 @@
174179
class="card-never border-r-4 mt-8"
175180
v-if="item.type !== WorkflowType.Application"
176181
>
177-
<h5 class="p-8-12">历史记录</h5>
182+
<h5 class="p-8-12">{{ $t('components.chat.history') }}</h5>
178183
<div class="p-8-12 border-t-dashed lighter">
179184
<template v-if="item.history_message?.length > 0">
180185
<p
@@ -278,7 +283,7 @@
278283
</template>
279284
<template v-if="item.type === WorkflowType.SpeechToTextNode">
280285
<div class="card-never border-r-4">
281-
<h5 class="p-8-12">参数输入</h5>
286+
<h5 class="p-8-12"> {{ $t('components.chat.executionDetails.paramInput') }}</h5>
282287
<div class="p-8-12 border-t-dashed lighter">
283288
<div class="mb-8">
284289
<div v-if="item.audio_list?.length > 0">
@@ -325,7 +330,7 @@
325330

326331
<template v-if="item.type === WorkflowType.TextToSpeechNode">
327332
<div class="card-never border-r-4">
328-
<h5 class="p-8-12">参数输入</h5>
333+
<h5 class="p-8-12"> {{ $t('components.chat.executionDetails.paramInput') }}</h5>
329334
<div class="p-8-12 border-t-dashed lighter">
330335
<div class="p-8-12 border-t-dashed lighter">
331336
<p class="mb-8 color-secondary">文本内容:</p>
@@ -467,7 +472,12 @@
467472
class="card-never border-r-4"
468473
v-if="item.type !== WorkflowType.Application"
469474
>
470-
<h5 class="p-8-12">角色设定 (System)</h5>
475+
<h5 class="p-8-12">
476+
{{
477+
$t('views.application.applicationForm.form.roleSettings.label')
478+
}}
479+
(System)
480+
</h5>
471481
<div class="p-8-12 border-t-dashed lighter">
472482
{{ item.system || '-' }}
473483
</div>
@@ -476,7 +486,7 @@
476486
class="card-never border-r-4 mt-8"
477487
v-if="item.type !== WorkflowType.Application"
478488
>
479-
<h5 class="p-8-12">历史记录</h5>
489+
<h5 class="p-8-12">{{ $t('components.chat.history') }}</h5>
480490
<div class="p-8-12 border-t-dashed lighter">
481491
<template v-if="item.history_message?.length > 0">
482492
<p

ui/src/components/card-add/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
</el-card>
88
</template>
99
<script setup lang="ts">
10+
import { t } from '@/locales'
1011
defineOptions({ name: 'CardAdd' })
1112
defineProps({
1213
title: {
1314
type: String,
14-
default: '标题'
15+
default: t('common.title')
1516
}
1617
})
1718
</script>

ui/src/components/card-box/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
</template>
4040
<script setup lang="ts">
4141
import { ref, useSlots } from 'vue'
42-
42+
import { t } from '@/locales'
4343
defineOptions({ name: 'CardBox' })
4444
const props = withDefaults(
4545
defineProps<{
@@ -56,7 +56,7 @@ const props = withDefaults(
5656
*/
5757
showIcon?: boolean
5858
}>(),
59-
{ title: '标题', description: '', showIcon: true, border: true }
59+
{ title: t('common.title'), description: '', showIcon: true, border: true }
6060
)
6161
6262
const show = ref(false)

ui/src/components/dynamics-form/FormItem.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import type { FormField } from '@/components/dynamics-form/type'
3535
import FormItemLabel from './FormItemLabel.vue'
3636
import type { Dict } from '@/api/type/common'
3737
import bus from '@/bus'
38+
import { t } from '@/locales'
3839
const props = defineProps<{
3940
// 双向绑定的值
4041
modelValue: any
@@ -104,8 +105,8 @@ const errMsg = computed(() => {
104105
return props_info.value.err_msg
105106
? props_info.value.err_msg
106107
: isString(props.formfield.label)
107-
? props.formfield.label + '不能为空'
108-
: props.formfield.label.label + '不能为空'
108+
? props.formfield.label + t('components.dynamicsForm.tip.requiredMessage')
109+
: props.formfield.label.label + t('components.dynamicsForm.tip.requiredMessage')
109110
})
110111
/**
111112
* 反序列化

ui/src/components/dynamics-form/items/JsonInput.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import { oneDark } from '@codemirror/theme-one-dark'
4343
import { Codemirror } from 'vue-codemirror'
4444
import { linter } from '@codemirror/lint'
4545
import { computed, ref } from 'vue'
46+
import { t } from '@/locales'
4647
const props = withDefaults(defineProps<{ modelValue?: any }>(), { modelValue: () => {} })
4748
const emit = defineEmits(['update:modelValue'])
4849
@@ -107,7 +108,7 @@ const validate_rules = (rule: any, value: any, callback: any) => {
107108
try {
108109
JSON.parse(model_value.value)
109110
} catch (e) {
110-
callback(new Error('JSON格式不正确'))
111+
callback(new Error(t('components.dynamicsForm.tip.requiredMessage')))
111112
return false
112113
}
113114
}

ui/src/components/dynamics-form/items/table/TableCheckbox.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<el-input
77
v-model="filterText"
88
:validate-event="false"
9-
placeholder="请输入关键字搜索"
9+
:placeholder="$t('components.dynamicsForm.searchBar.placeholder')"
1010
class="input-with-select"
1111
style="--el-color-danger: #c0c4cc"
1212
clearable

ui/src/components/dynamics-form/items/table/TableRadio.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<el-input
77
v-model="filterText"
88
:validate-event="false"
9-
placeholder="请输入关键字搜索"
9+
:placeholder="$t('components.dynamicsForm.searchBar.placeholder')"
1010
class="input-with-select"
1111
style="--el-color-danger: #c0c4cc"
1212
clearable

ui/src/components/generate-related-dialog/index.vue

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<el-dialog
3-
:title="$t('views.document.setting.generateQuestion')"
3+
:title="$t('views.document.setting.generateQuestion.title')"
44
v-model="dialogVisible"
55
width="650"
66
:close-on-click-modal="false"
@@ -19,23 +19,31 @@
1919
<AppIcon iconName="app-warning-colorful" style="font-size: 16px"></AppIcon>
2020
</div>
2121
<div class="ml-12 lighter">
22-
<p>提示词中的 {data} 为分段内容的占位符,执行时替换为分段内容发送给 AI 模型;</p>
23-
<p>
24-
AI
25-
模型根据分段内容生成相关问题,请将生成的问题放至&lt;question&gt;&lt;/question&gt;标签中,系统会自动关联标签中的问题;
26-
</p>
27-
<p>生成效果依赖于所选模型和提示词,用户可自行调整至最佳效果。</p>
22+
<p>{{ $t('views.document.setting.generateQuestion.tip1', { data: '{data}' }) }}</p>
23+
<p>{{ $t('views.document.setting.generateQuestion.tip2') }}</p>
24+
<p>{{ $t('views.document.setting.generateQuestion.tip3') }}</p>
2825
</div>
2926
</div>
30-
<el-form-item label="AI 模型" prop="model_id">
27+
<el-form-item
28+
:label="$t('views.application.applicationForm.form.aiModel.label')"
29+
prop="model_id"
30+
>
3131
<ModelSelect
3232
v-model="form.model_id"
3333
:placeholder="$t('views.application.applicationForm.form.aiModel.placeholder')"
3434
:options="modelOptions"
3535
></ModelSelect>
3636
</el-form-item>
37-
<el-form-item label="提示词" prop="prompt">
38-
<el-input v-model="form.prompt" placeholder="请输入提示词" :rows="7" type="textarea" />
37+
<el-form-item
38+
:label="$t('views.application.applicationForm.form.prompt.label')"
39+
prop="prompt"
40+
>
41+
<el-input
42+
v-model="form.prompt"
43+
:placeholder="$t('views.application.applicationForm.form.prompt.placeholder')"
44+
:rows="7"
45+
type="textarea"
46+
/>
3947
</el-form-item>
4048
</el-form>
4149
</div>
@@ -82,8 +90,20 @@ const userId = user.userInfo?.id as string
8290
const form = ref(prompt.get(userId))
8391
8492
const rules = reactive({
85-
model_id: [{ required: true, message: '请选择AI 模型', trigger: 'blur' }],
86-
prompt: [{ required: true, message: '请输入提示词', trigger: 'blur' }]
93+
model_id: [
94+
{
95+
required: true,
96+
message: t('views.application.applicationForm.form.aiModel.placeholder'),
97+
trigger: 'blur'
98+
}
99+
],
100+
prompt: [
101+
{
102+
required: true,
103+
message: t('views.application.applicationForm.form.prompt.placeholder'),
104+
trigger: 'blur'
105+
}
106+
]
87107
})
88108
89109
const open = (ids: string[], type: string) => {
@@ -104,14 +124,14 @@ const submitHandle = async (formEl: FormInstance) => {
104124
if (apiType.value === 'paragraph') {
105125
const data = { ...form.value, paragraph_id_list: idList.value }
106126
paragraphApi.batchGenerateRelated(id, documentId, data, loading).then(() => {
107-
MsgSuccess('生成问题成功')
127+
MsgSuccess(t('views.document.setting.generateQuestion.successMessage'))
108128
emit('refresh')
109129
dialogVisible.value = false
110130
})
111131
} else if (apiType.value === 'document') {
112132
const data = { ...form.value, document_id_list: idList.value }
113133
documentApi.batchGenerateRelated(id, data, loading).then(() => {
114-
MsgSuccess('生成问题成功')
134+
MsgSuccess(t('views.document.setting.generateQuestion.successMessage'))
115135
emit('refresh')
116136
dialogVisible.value = false
117137
})

ui/src/components/tag-ellipsis/index.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
</el-tag>
55
</template>
66
<script setup lang="ts">
7-
import { ref, computed, useSlots } from 'vue'
87
defineOptions({ name: 'TagEllipsis' })
98
</script>
109
<style lang="scss" scoped>

ui/src/components/tags-input/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const querySearchAsync = (queryString: string, cb: (arg: any) => void) => {
6666
UserApi.getUserList(queryString).then((res) => {
6767
if (res.data.length === 0) {
6868
noData.value = true
69-
matchResults = [{ default: '无匹配数据' }]
69+
matchResults = [{ default: t('components.noData') }]
7070
} else {
7171
noData.value = false
7272
matchResults = res.data

0 commit comments

Comments
 (0)