feat: i18n

This commit is contained in:
王丹 2025-01-16 22:55:42 +08:00
parent 8fcf935201
commit 5c4d61c45c
7 changed files with 74 additions and 26 deletions

View File

@ -198,7 +198,11 @@
</div>
<div class="card-never border-r-4 mt-8">
<h5 class="p-8-12">
{{ item.type == WorkflowType.Application ? '参数输出' : 'AI 回答' }}
{{
item.type == WorkflowType.Application
? $t('components.chat.executionDetails.paramOutput')
: 'AI 回答'
}}
</h5>
<div class="p-8-12 border-t-dashed lighter">
<MdPreview
@ -236,7 +240,9 @@
<template v-if="item.type === WorkflowType.DocumentExtractNode">
<div class="card-never border-r-4">
<h5 class="p-8-12 flex align-center">
<span class="mr-4">参数输出</span>
<span class="mr-4">{{
$t('components.chat.executionDetails.paramOutput')
}}</span>
<el-tooltip
effect="dark"
@ -291,7 +297,9 @@
</div>
</div>
<div class="card-never border-r-4">
<h5 class="p-8-12">参数输出</h5>
<h5 class="p-8-12">
{{ $t('components.chat.executionDetails.paramOutput') }}
</h5>
<div class="p-8-12 border-t-dashed lighter">
<el-card
shadow="never"
@ -331,7 +339,9 @@
</div>
</div>
<div class="card-never border-r-4">
<h5 class="p-8-12">参数输出</h5>
<h5 class="p-8-12">
{{ $t('components.chat.executionDetails.paramOutput') }}
</h5>
<div class="p-8-12 border-t-dashed lighter">
<p class="mb-8 color-secondary">语音文件:</p>
<div v-if="item.answer" v-html="item.answer"></div>
@ -429,7 +439,8 @@
<template v-if="item.type === WorkflowType.FormNode">
<div class="card-never border-r-4">
<h5 class="p-8-12">
参数输出<span style="color: #f54a45">{{
{{ $t('components.chat.executionDetails.paramOutput')
}}<span style="color: #f54a45">{{
item.is_submit ? '' : '(用户未提交)'
}}</span>
</h5>
@ -517,7 +528,11 @@
</div>
<div class="card-never border-r-4 mt-8">
<h5 class="p-8-12">
{{ item.type == WorkflowType.Application ? '参数输出' : 'AI 回答' }}
{{
item.type == WorkflowType.Application
? $t('components.chat.executionDetails.paramOutput')
: 'AI 回答'
}}
</h5>
<div class="p-8-12 border-t-dashed lighter">
<MdPreview
@ -541,7 +556,11 @@
</div>
<div class="card-never border-r-4 mt-8">
<h5 class="p-8-12">
{{ item.type == WorkflowType.Application ? '参数输出' : 'AI 回答' }}
{{
item.type == WorkflowType.Application
? $t('components.chat.executionDetails.paramOutput')
: 'AI 回答'
}}
</h5>
<div class="p-8-12 border-t-dashed lighter">
<MdPreview

View File

@ -14,6 +14,7 @@ import { MsgSuccess } from '@/utils/message'
import AppIcon from '@/components/icons/AppIcon.vue'
import bus from '@/bus'
import { ref, nextTick, onMounted } from 'vue'
import { t } from '@/locales'
const isOpen = ref<boolean>(false)
const eventVal = ref({})
function getSelection() {
@ -42,14 +43,14 @@ const openControl = (event: any) => {
const menus = ref([
{
label: '复制',
label: t('common.copy'),
icon: 'app-copy',
click: () => {
const selectionText = getSelection()
if (selectionText) {
clearSelectedText()
navigator.clipboard.writeText(selectionText).then(() => {
MsgSuccess('复制成功')
MsgSuccess(t('common.copySuccess'))
})
}
}

View File

@ -9,5 +9,8 @@ export default {
title: '请输入密码打开链接',
errorMessage1: '密码不能为空',
errorMessage2: '密码错误'
},
executionDetails: {
paramOutput: '参数输出',
}
}

View File

@ -15,7 +15,8 @@ export default {
public: '发布',
releaseHistory: '发布历史',
autoSave: '自动保存',
latestRelease: '最近发布'
latestRelease: '最近发布',
copyParam: '复制参数'
},
tip: {
publicSuccess: '发布成功',
@ -23,13 +24,26 @@ export default {
nameMessage: '名字不能为空!',
onlyRight: '只允许从右边的锚点连出',
notRecyclable: '不可循环连线',
onlylest: '只允许连接左边的锚点'
onlylest: '只允许连接左边的锚点',
applicationNodeError: '该应用不可用',
functionNodeError: '该函数不可用',
repeatedNodeError: '节点名称已存在!'
},
delete: {
confirmTitle: '确定删除该节点?'
},
variable: {
global: '全局变量',
Referencing: '引用变量',
ReferencingRequired: '引用变量必填',
ReferencingError: '引用变量错误',
NoReferencing:'不存在的引用变量',
NoReferencing: '不存在的引用变量'
},
condition: {
title: '执行条件',
front: '前置',
AND: '所有',
OR: '任一',
text: '连线节点执行完,执行当前节点'
}
}

View File

@ -49,14 +49,17 @@
</el-button>
<template #dropdown>
<div style="width: 280px" class="p-12-16">
<h5>执行条件</h5>
<h5>{{ $t('views.applicationWorkflow.condition.title') }}</h5>
<p class="mt-8 lighter">
<span>前置</span>
<span>{{ $t('views.applicationWorkflow.condition.front') }}</span>
<el-select v-model="condition" size="small" style="width: 60px; margin: 0 8px">
<el-option label="所有" value="AND" />
<el-option label="任一" value="OR" />
<el-option
:label="$t('views.applicationWorkflow.condition.AND')"
value="AND"
/>
<el-option :label="$t('views.applicationWorkflow.condition.OR')" value="OR" />
</el-select>
<span>连线节点执行完执行当前节点</span>
<span>{{ $t('views.applicationWorkflow.condition.text') }}</span>
</p>
</div>
</template>
@ -67,7 +70,9 @@
</el-button>
<template #dropdown>
<el-dropdown-menu style="min-width: 80px">
<el-dropdown-item @click="copyNode" class="p-8">复制</el-dropdown-item>
<el-dropdown-item @click="copyNode" class="p-8">{{
$t('common.copy')
}}</el-dropdown-item>
<el-dropdown-item @click="deleteNode" class="border-t p-8">{{
$t('common.delete')
}}</el-dropdown-item>
@ -81,14 +86,20 @@
<el-alert
v-if="node_status != 200"
class="mb-16"
:title="props.nodeModel.type === 'application-node' ? '该应用不可用' : '该函数不可用'"
:title="
props.nodeModel.type === 'application-node'
? $t('views.applicationWorkflow.tip.applicationNodeError')
: $t('views.applicationWorkflow.tip.functionNodeError')
"
type="error"
show-icon
:closable="false"
/>
<slot></slot>
<template v-if="nodeFields.length > 0">
<h5 class="title-decoration-1 mb-8 mt-8">参数输出</h5>
<h5 class="title-decoration-1 mb-8 mt-8">
{{ $t('components.chat.executionDetails.paramOutput') }}
</h5>
<template v-for="(item, index) in nodeFields" :key="index">
<div
class="flex-between border-r-4 p-8-12 mb-8 layout-bg lighter"
@ -98,7 +109,7 @@
<span style="max-width: 92%">{{ item.label }} {{ '{' + item.value + '}' }}</span>
<el-tooltip
effect="dark"
content="复制参数"
:content="$t('views.applicationWorkflow.setting.copyParam')"
placement="top"
v-if="showicon === index"
>
@ -138,7 +149,7 @@ import { iconComponent } from '../icons/utils'
import { copyClick } from '@/utils/clipboard'
import { WorkflowType } from '@/enums/workflow'
import { MsgError, MsgConfirm } from '@/utils/message'
import { t } from '@/locales'
const {
params: { id }
} = app.config.globalProperties.$route as any
@ -200,7 +211,7 @@ function editName(val: string) {
) {
set(props.nodeModel.properties, 'stepName', val.trim())
} else {
MsgError('节点名称已存在!')
MsgError(t('views.applicationWorkflow.tip.repeatedNodeError'))
}
}
}
@ -219,7 +230,7 @@ const copyNode = () => {
props.nodeModel.graphModel.toFront(cloneNode.id)
}
const deleteNode = () => {
MsgConfirm(t('common.tip'), `确定删除该节点?`, {
MsgConfirm(t('common.tip'), t('views.applicationWorkflow.delete.confirmTitle'), {
confirmButtonText: t('common.delete'),
confirmButtonClass: 'danger'
}).then(() => {

View File

@ -99,7 +99,7 @@ export function initDefaultShortcut(lf: LogicFlow, graph: GraphModel) {
MsgError(`${nodes[0].properties?.stepName}节点不允许删除`)
return
}
MsgConfirm(t('common.tip'), `确定删除该节点?`, {
MsgConfirm(t('common.tip'), t('views.applicationWorkflow.delete.confirmTitle'), {
confirmButtonText: t('common.delete'),
confirmButtonClass: 'danger'
}).then(() => {

View File

@ -9,7 +9,7 @@
@mouseleave="showicon = false"
>
<span>{{ item.label }} {{ '{' + item.value + '}' }}</span>
<el-tooltip effect="dark" content="复制参数" placement="top" v-if="showicon === true">
<el-tooltip effect="dark" :content="$t('views.applicationWorkflow.setting.copyParam')" placement="top" v-if="showicon === true">
<el-button
link
@click="copyClick('{{' + '全局变量.' + item.value + '}}')"