Skip to content

Commit 8fcf935

Browse files
author
王丹
committed
feat: i18n
1 parent 7eb17ba commit 8fcf935

File tree

15 files changed

+136
-62
lines changed

15 files changed

+136
-62
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export default {
2+
noHistory: '暂无历史记录',
3+
createChat: '新建对话',
4+
history: '历史记录',
5+
only20history: '仅显示最近 20 条对话',
6+
question_count: '条提问',
7+
exportReords: '导出聊天记录',
8+
passwordValidator: {
9+
title: '请输入密码打开链接',
10+
errorMessage1: '密码不能为空',
11+
errorMessage2: '密码错误'
12+
}
13+
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import dynamicsForm from './dynamics-form'
2+
import chat from './ai-chat'
23
export default {
3-
dynamicsForm
4+
dynamicsForm,
5+
chat
46
}
Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
11
export default {
2-
2+
node: '节点',
3+
baseNodes: '基础组件',
4+
searchBar: {
5+
placeholder: '按名称搜索'
6+
},
7+
info: {
8+
previewVersion: '预览版本:',
9+
saveTime: '保存时间:'
10+
},
11+
setting: {
12+
restoreVersion: '恢复版本',
13+
restoreCurrentVersion: '恢复此版本',
14+
addComponent: '添加组件',
15+
public: '发布',
16+
releaseHistory: '发布历史',
17+
autoSave: '自动保存',
18+
latestRelease: '最近发布'
19+
},
20+
tip: {
21+
publicSuccess: '发布成功',
22+
noData: '没有找到相关结果',
23+
nameMessage: '名字不能为空!',
24+
onlyRight: '只允许从右边的锚点连出',
25+
notRecyclable: '不可循环连线',
26+
onlylest: '只允许连接左边的锚点'
27+
},
28+
variable: {
29+
global: '全局变量',
30+
Referencing: '引用变量',
31+
ReferencingRequired: '引用变量必填',
32+
ReferencingError: '引用变量错误',
33+
NoReferencing:'不存在的引用变量',
34+
}
335
}

ui/src/locales/lang/zh_CN/views/application.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import Password from '@/views/chat/auth/component/password.vue'
2+
import { create } from 'lodash'
3+
14
export default {
25
title: '应用',
36
createApplication: '创建应用',
@@ -195,5 +198,6 @@ export default {
195198
text: '针对用户提问调试段落匹配情况,保障回答效果。',
196199
emptyMessage1: '命中段落显示在这里',
197200
emptyMessage2: '没有命中的分段'
198-
}
201+
},
202+
199203
}

ui/src/locales/lang/zh_CN/views/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import document from './document';
1111
import paragraph from './paragraph';
1212
import problem from './problem';
1313
import log from './log';
14+
import applicationWorkflow from './application-workflow';
1415
export default {
1516
notFound,
1617
application,
@@ -24,5 +25,6 @@ export default {
2425
document,
2526
paragraph,
2627
problem,
27-
log
28+
log,
29+
applicationWorkflow
2830
};

ui/src/views/application-workflow/component/DropdownMenu.vue

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
<div v-show="show" class="workflow-dropdown-menu border border-r-4">
33
<el-tabs v-model="activeName" class="workflow-dropdown-tabs">
44
<div style="display: flex; width: 100%; justify-content: center" class="mb-4">
5-
<el-input v-model="search_text" style="width: 240px" placeholder="按名称搜索">
5+
<el-input
6+
v-model="search_text"
7+
style="width: 240px"
8+
:placeholder="$t('views.applicationWorkflow.searchBar.placeholder')"
9+
>
610
<template #suffix>
711
<el-icon class="el-input__icon"><search /></el-icon>
812
</template>
913
</el-input>
1014
</div>
1115

12-
<el-tab-pane label="基础组件" name="base">
16+
<el-tab-pane :label="$t('views.applicationWorkflow.baseNodes')" name="base">
1317
<el-scrollbar height="400">
1418
<div v-if="filter_menu_nodes.length > 0">
1519
<template v-for="(item, index) in filter_menu_nodes" :key="index">
@@ -27,11 +31,11 @@
2731
</template>
2832
</div>
2933
<div v-else class="ml-16 mt-8">
30-
<el-text type="info">没有找到相关结果</el-text>
34+
<el-text type="info">{{ $t('views.applicationWorkflow.tip.noData') }}</el-text>
3135
</div>
3236
</el-scrollbar>
3337
</el-tab-pane>
34-
<el-tab-pane label="函数库" name="function">
38+
<el-tab-pane :label="$t('views.functionLib.title')" name="function">
3539
<el-scrollbar height="400">
3640
<div
3741
class="workflow-dropdown-item cursor flex p-8-12"
@@ -69,7 +73,7 @@
6973
</template>
7074
</el-scrollbar>
7175
</el-tab-pane>
72-
<el-tab-pane label="应用" name="application">
76+
<el-tab-pane :label="$t('views.application.title')" name="application">
7377
<el-scrollbar height="400">
7478
<div v-if="filter_application_list.length > 0">
7579
<template v-for="(item, index) in filter_application_list" :key="index">
@@ -100,16 +104,18 @@
100104
</p>
101105
</div>
102106
<div class="status-tag" style="margin-left: auto">
103-
<el-tag type="warning" v-if="isWorkFlow(item.type)" style="height: 22px"
104-
>高级编排</el-tag
107+
<el-tag type="warning" v-if="isWorkFlow(item.type)" style="height: 22px">
108+
{{ $t('views.application.workflow') }}</el-tag
105109
>
106-
<el-tag class="blue-tag" v-else style="height: 22px">简单配置</el-tag>
110+
<el-tag class="blue-tag" v-else style="height: 22px">{{
111+
$t('views.application.simple')
112+
}}</el-tag>
107113
</div>
108114
</div>
109115
</template>
110116
</div>
111117
<div v-else class="ml-16 mt-8">
112-
<el-text type="info">没有找到相关结果</el-text>
118+
<el-text type="info">{{ $t('views.applicationWorkflow.tip.noData') }}</el-text>
113119
</div>
114120
</el-scrollbar>
115121
</el-tab-pane>

ui/src/views/application-workflow/component/PublishHistory.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="workflow-publish-history border-l">
3-
<h4 class="border-b p-16-24">发布历史</h4>
3+
<h4 class="border-b p-16-24">{{ $t('views.applicationWorkflow.setting.releaseHistory') }}</h4>
44
<div class="list-height pt-0">
55
<el-scrollbar>
66
<div class="p-8 pt-0">
@@ -23,7 +23,9 @@
2323
:write="row.writeStatus"
2424
@close="closeWrite(row)"
2525
/>
26-
<el-tag v-if="index === 0" class="default-tag ml-4">最近发布</el-tag>
26+
<el-tag v-if="index === 0" class="default-tag ml-4">{{
27+
$t('views.applicationWorkflow.setting.latestRelease')
28+
}}</el-tag>
2729
</h5>
2830
<el-text type="info" class="color-secondary flex mt-8">
2931
<AppAvatar :size="20" class="avatar-grey mr-4">
@@ -46,7 +48,7 @@
4648
</el-dropdown-item>
4749
<el-dropdown-item @click="refreshVersion(row)">
4850
<el-icon><RefreshLeft /></el-icon>
49-
恢复此版本
51+
{{ $t('views.applicationWorkflow.setting.restoreCurrentVersion') }}
5052
</el-dropdown-item>
5153
</el-dropdown-menu>
5254
</template>
@@ -57,7 +59,7 @@
5759

5860
<template #empty>
5961
<div class="text-center">
60-
<el-text type="info">暂无历史记录</el-text>
62+
<el-text type="info"> {{ $t('components.chat.noHistory') }}</el-text>
6163
</div>
6264
</template>
6365
</common-list>
@@ -72,6 +74,7 @@ import { useRoute } from 'vue-router'
7274
import applicationApi from '@/api/application'
7375
import { datetimeFormat } from '@/utils/time'
7476
import { MsgSuccess, MsgError } from '@/utils/message'
77+
import { t } from '@/locales'
7578
const route = useRoute()
7679
const {
7780
params: { id }
@@ -114,7 +117,7 @@ function editName(val: string, item: any) {
114117
getList()
115118
})
116119
} else {
117-
MsgError('名字不能为空!')
120+
MsgError(t('views.applicationWorkflow.tip.nameMessage'))
118121
}
119122
}
120123

ui/src/views/application-workflow/index.vue

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,26 @@
88
<h4>{{ detail?.name }}</h4>
99
<div v-if="showHistory && disablePublic">
1010
<el-text type="info" class="ml-16 color-secondary"
11-
>预览版本:
11+
>{{ $t('views.applicationWorkflow.info.previewVersion') }}
1212
{{ currentVersion.name || datetimeFormat(currentVersion.update_time) }}</el-text
1313
>
1414
</div>
1515
<el-text type="info" class="ml-16 color-secondary" v-else-if="saveTime"
16-
>保存时间:{{ datetimeFormat(saveTime) }}</el-text
16+
>{{ $t('views.applicationWorkflow.info.saveTime')
17+
}}{{ datetimeFormat(saveTime) }}</el-text
1718
>
1819
</div>
1920
<div v-if="showHistory && disablePublic">
20-
<el-button type="primary" class="mr-8" @click="refreshVersion()"> 恢复版本 </el-button>
21+
<el-button type="primary" class="mr-8" @click="refreshVersion()">
22+
{{ $t('views.applicationWorkflow.setting.restoreVersion') }}
23+
</el-button>
2124
<el-divider direction="vertical" />
2225
<el-button text @click="closeHistory">
2326
<el-icon><Close /></el-icon>
2427
</el-button>
2528
</div>
2629
<div v-else>
27-
<el-button icon="Plus" @click="showPopover = !showPopover"> 添加组件 </el-button>
30+
<el-button icon="Plus" @click="showPopover = !showPopover"> {{ $t('views.applicationWorkflow.setting.addComponent') }} </el-button>
2831
<el-button @click="clickShowDebug" :disabled="showDebug">
2932
<AppIcon iconName="app-play-outlined" class="mr-4"></AppIcon>
3033
{{ $t('common.debug') }}</el-button
@@ -33,7 +36,7 @@
3336
<AppIcon iconName="app-save-outlined" class="mr-4"></AppIcon>
3437
{{ $t('common.save') }}
3538
</el-button>
36-
<el-button type="primary" @click="publicHandle"> 发布 </el-button>
39+
<el-button type="primary" @click="publicHandle"> {{ $t('views.applicationWorkflow.setting.public') }} </el-button>
3740

3841
<el-dropdown trigger="click">
3942
<el-button text @click.stop class="ml-8 mt-4">
@@ -43,11 +46,11 @@
4346
<el-dropdown-menu>
4447
<el-dropdown-item @click="openHistory">
4548
<AppIcon iconName="app-history-outlined"></AppIcon>
46-
发布历史
49+
{{ $t('views.applicationWorkflow.setting.releaseHistory') }}
4750
</el-dropdown-item>
4851
<el-dropdown-item>
4952
<AppIcon iconName="app-save-outlined"></AppIcon>
50-
自动保存
53+
{{ $t('views.applicationWorkflow.setting.autoSave') }}
5154
<div class="ml-4">
5255
<el-switch size="small" v-model="isSave" @change="changeSave" />
5356
</div>
@@ -146,7 +149,7 @@ import { datetimeFormat } from '@/utils/time'
146149
import useStore from '@/stores'
147150
import { WorkFlowInstance } from '@/workflow/common/validate'
148151
import { hasPermission } from '@/utils/permission'
149-
152+
import { t } from '@/locales'
150153
const { user, application } = useStore()
151154
const router = useRouter()
152155
const route = useRoute()
@@ -258,17 +261,17 @@ async function publicHandle() {
258261
return
259262
}
260263
applicationApi.putPublishApplication(id as String, obj, loading).then(() => {
261-
MsgSuccess('发布成功')
264+
MsgSuccess(t('views.applicationWorkflow.tip.publicSuccess'))
262265
})
263266
})
264267
.catch((res: any) => {
265268
const node = res.node
266269
const err_message = res.errMessage
267270
if (typeof err_message == 'string') {
268-
MsgError(res.node.properties?.stepName + '节点 ' + err_message)
271+
MsgError(res.node.properties?.stepName + `${t('views.applicationWorkflow.node')} ` + err_message)
269272
} else {
270273
const keys = Object.keys(err_message)
271-
MsgError(node.properties?.stepName + '节点 ' + err_message[keys[0]]?.[0]?.message)
274+
MsgError(node.properties?.stepName + `${t('views.applicationWorkflow.node')} ` + err_message[keys[0]]?.[0]?.message)
272275
}
273276
})
274277
}
@@ -297,10 +300,10 @@ const clickShowDebug = () => {
297300
const node = res.node
298301
const err_message = res.errMessage
299302
if (typeof err_message == 'string') {
300-
MsgError(res.node.properties?.stepName + '节点 ' + err_message)
303+
MsgError(res.node.properties?.stepName + `${t('views.applicationWorkflow.node')} ` + err_message)
301304
} else {
302305
const keys = Object.keys(err_message)
303-
MsgError(node.properties?.stepName + '节点 ' + err_message[keys[0]]?.[0]?.message)
306+
MsgError(node.properties?.stepName + `${t('views.applicationWorkflow.node')} ` + err_message[keys[0]]?.[0]?.message)
304307
}
305308
})
306309
}

ui/src/views/chat/auth/component/password.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
:modelValue="show"
44
modal-class="positioned-mask"
55
width="300"
6-
title="请输入密码打开链接"
6+
:title="$t('components.chat.passwordValidator.title')"
77
custom-class="no-close-button"
88
:close-on-click-modal="false"
99
:close-on-press-escape="false"
@@ -26,6 +26,7 @@
2626
import { ref, computed } from 'vue'
2727
import { useRoute } from 'vue-router'
2828
import useStore from '@/stores'
29+
import { t } from '@/locales'
2930
const route = useRoute()
3031
const FormRef = ref()
3132
const {
@@ -51,10 +52,10 @@ const auth = () => {
5152
}
5253
const validator_auth = (rule: any, value: string, callback: any) => {
5354
if (value === '') {
54-
callback(new Error('密码不能为空'))
55+
callback(new Error(t('components.chat.passwordValidator.errorMessage1')))
5556
} else {
5657
auth().catch(() => {
57-
callback(new Error('密码错误'))
58+
callback(new Error(t('components.chat.passwordValidator.errorMessage2')))
5859
})
5960
}
6061
}

ui/src/views/chat/embed/index.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
<template #operateBefore>
4848
<div class="chat-width">
4949
<el-button type="primary" link class="new-chat-button mb-8" @click="newChat">
50-
<el-icon><Plus /></el-icon><span class="ml-4">新建对话</span>
50+
<el-icon><Plus /></el-icon
51+
><span class="ml-4">{{ $t('components.chat.createChat') }}</span>
5152
</el-button>
5253
</div>
5354
</template>
@@ -71,7 +72,7 @@
7172
<el-collapse-transition>
7273
<div v-show="show" class="chat-popover w-full" v-click-outside="clickoutside">
7374
<div class="border-b p-16-24">
74-
<span>历史记录</span>
75+
<span>{{ $t('components.chat.history') }}</span>
7576
</div>
7677

7778
<el-scrollbar max-height="300">
@@ -99,13 +100,13 @@
99100
</template>
100101
<template #empty>
101102
<div class="text-center mt-24">
102-
<el-text type="info">暂无历史记录</el-text>
103+
<el-text type="info">{{ $t('components.chat.noHistory') }}</el-text>
103104
</div>
104105
</template>
105106
</common-list>
106107
</div>
107108
<div v-if="chatLogData.length" class="gradient-divider lighter mt-8">
108-
<span>仅显示最近 20 条对话</span>
109+
<span>{{ $t('components.chat.only20history') }}</span>
109110
</div>
110111
</el-scrollbar>
111112
</div>
@@ -119,7 +120,6 @@ import { ref, onMounted, reactive, nextTick, computed } from 'vue'
119120
import { isAppIcon } from '@/utils/application'
120121
import { hexToRgba } from '@/utils/theme'
121122
import useStore from '@/stores'
122-
123123
const { user, log } = useStore()
124124
125125
const AiChatRef = ref()

0 commit comments

Comments
 (0)