Merge pull request #12703 from dataease/pr@dev-v2_st

feat(数据源): 国际化
This commit is contained in:
dataeaseShu 2024-10-15 10:34:58 +08:00 committed by GitHub
commit e6d43e0320
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 136 additions and 65 deletions

View File

@ -190,10 +190,38 @@ export default {
cannot_be_empty_de_ruler: 'Rule condition cannot be empty'
},
data_source: {
successfully_created: 'Successfully created',
continue_to_create: 'Continue to create',
data_source_list: 'Return to the data source list',
prompts_next_time: 'No more prompts next time',
also_want_to: 'You may also want to',
or_large_screen: 'Prepare for the next dashboard or large screen',
go_to_create: 'Go to create',
verification_successful: 'Verification successful',
verification_failed: 'Verification failed',
create_successfully: 'Create successfully',
by_creation_time: 'In ascending order by creation time',
by_creation_time_de: 'In descending order by creation time',
order_by_name: 'In ascending order by name',
order_by_name_de: 'In descending order by name',
operate_with_caution:
'After deletion, all resources under this folder will be deleted, please operate with caution.',
confirm_to_delete:
'A dataset is using this data source. After deletion, the dataset is unavailable. Confirm to delete?',
view_blood_relationship: 'View blood relationship',
no_data_source: 'No data source',
replace_data: 'Replace data',
append_data: 'Append data',
latest_update_status: 'Latest update status',
latest_update_time: 'Latest update time',
data_time: 'Data time:',
update_all: 'Update all',
on_the_left: 'Please select a data source on the left',
update_result: 'Update result',
failure_details: 'Failure details',
the_request_address: 'Please enter the request address',
name_already_exists: 'A parameter with the same name already exists:',
name_already_exists_de: 'A parameter table with the same name already exists',
verification_failed: 'Verification failed',
interface_parameters: 'Interface parameters',
extract_parameters: 'Extract parameters',
view_data_structure: 'View data structure',
@ -257,8 +285,6 @@ export default {
the_previous_step:
'The filled in information will be cleared. Are you sure you want to return to the previous step?',
add_data_table: 'Need to add data table',
replace_data: 'Replace data',
append_data: 'append data',
copy_data_source: 'Copy data source',
create_data_source: 'Create data source',
want_to_exit: 'The current changes have not been saved. Are you sure you want to exit?',

View File

@ -207,6 +207,33 @@ export default {
cannot_be_empty_de_ruler: '规则条件不能为空'
},
data_source: {
successfully_created: '创建成功',
continue_to_create: '继续创建',
data_source_list: '返回数据源列表',
prompts_next_time: '下次不再提示',
also_want_to: '您可能还想',
or_large_screen: '为下一步的仪表板或大屏做准备',
go_to_create: '去创建',
verification_successful: '校验成功',
verification_failed: '校验失败',
create_successfully: '新建成功',
by_creation_time: '按创建时间升序',
by_creation_time_de: '按创建时间降序',
order_by_name: '按照名称升序',
order_by_name_de: '按照名称降序',
operate_with_caution: '删除后此文件夹下的所有资源都会被删除请谨慎操作',
confirm_to_delete: '有数据集正在使用此数据源删除后数据集不可用确认删除',
view_blood_relationship: '查看血缘关系',
no_data_source: '暂无数据源',
replace_data: '替换数据',
append_data: '追加数据',
latest_update_status: '最近更新状态',
latest_update_time: '最近更新时间',
data_time: '数据时间',
update_all: '全部更新',
on_the_left: '请在左侧选择数据源',
update_result: '更新结果',
failure_details: '失败详情',
the_request_address: '请输入请求地址',
name_already_exists: '已经存在同名参数',
name_already_exists_de: '已经存在同名的参数表',
@ -269,10 +296,7 @@ export default {
cannot_be_empty_table: '数据表不能为空',
the_previous_step: '填写的信息将会清空确定返回上一步吗',
add_data_table: '需要添加数据表',
verification_failed: '校验失败',
source_saved_successfully: '保存数据源成功',
replace_data: '替换数据',
append_data: '追加数据',
copy_data_source: '复制数据源',
create_data_source: '创建数据源',
want_to_exit: '当前的更改尚未保存,确定退出吗?',

View File

@ -5,12 +5,14 @@ import { ref } from 'vue'
import { propTypes } from '@/utils/propTypes'
import { useCache } from '@/hooks/web/useCache'
import { setShowFinishPage } from '@/api/datasource'
import { useI18n } from '@/hooks/web/useI18n'
defineProps({
name: propTypes.string.def(''),
disabled: propTypes.bool.def(false)
})
const { t } = useI18n()
const { wsCache } = useCache()
const emits = defineEmits(['createDataset', 'backToDatasourceList', 'continueCreating'])
const checked = ref(false)
@ -39,27 +41,35 @@ const handleChange = (val: boolean) => {
<Icon name="icon_succeed_colorful"><icon_succeed_colorful class="svg-icon" /></Icon>
</el-icon>
<div class="succeed-text">创建成功</div>
<div class="succeed-text">{{ t('data_source.successfully_created') }}</div>
<div class="btn-list">
<el-button @click="continueCreating" secondary> 继续创建 </el-button>
<el-button @click="backToDatasourceList" type="primary"> 返回数据源列表 </el-button>
<el-button @click="continueCreating" secondary>
{{ t('data_source.continue_to_create') }}
</el-button>
<el-button @click="backToDatasourceList" type="primary">
{{ t('data_source.data_source_list') }}
</el-button>
</div>
<div class="nolonger-tips">
<el-checkbox @change="handleChange" v-model="checked" label="下次不再提示" />
<el-checkbox
@change="handleChange"
v-model="checked"
:label="t('data_source.prompts_next_time')"
/>
</div>
<div class="maybe-want" v-permission="['dataset']">
<div class="title">您可能还想</div>
<div class="title">{{ t('data_source.also_want_to') }}</div>
<div class="ds-info">
<el-icon class="ds">
<Icon name="icon_dataset"><icon_dataset class="svg-icon" /></Icon>
</el-icon>
<div class="info">
<p class="name">{{ $t('auth.dataset') }}</p>
<p class="size">为下一步的仪表板或大屏做准备</p>
<p class="size">{{ t('data_source.or_large_screen') }}</p>
</div>
<el-button class="create" secondary :disabled="disabled" @click="createDataset">
去创建
{{ t('data_source.go_to_create') }}
</el-button>
</div>
</div>

View File

@ -148,17 +148,17 @@ const datasourceEditor = ref()
const activeTab = ref('')
const menuList = [
{
label: '移动到',
label: t('data_set.move_to'),
svgName: icon_intoItem_outlined,
command: 'move'
},
{
label: '重命名',
label: t('data_set.rename'),
svgName: icon_rename_outlined,
command: 'rename'
},
{
label: '删除',
label: t('common.delete'),
divided: true,
svgName: icon_deleteTrash_outlined,
command: 'delete'
@ -173,12 +173,12 @@ const typeMap = dsTypes.reduce((pre, next) => {
const datasetTypeList = computed(() => {
return [
{
label: '新建数据源',
label: t('datasource.create'),
svgName: icon_dataset,
command: 'datasource'
},
{
label: '新建文件夹',
label: t('deDataset.new_folder'),
divided: true,
svgName: dvFolder,
command: 'folder'
@ -285,12 +285,12 @@ const validateDS = () => {
}
}
if (error === 0) {
ElMessage.success('校验成功')
ElMessage.success(t('data_source.verification_successful'))
} else {
ElMessage.error('校验失败')
ElMessage.error(t('data_source.verification_failed'))
}
} else {
ElMessage.success('校验成功')
ElMessage.success(t('data_source.verification_successful'))
}
})
}
@ -321,7 +321,9 @@ const formatSimpleCron = (info?: SyncSetting) => {
case 'SIMPLE_CRON':
const type = t(`common.${simpleCronType}`)
strArr.push(
`${t('dataset.simple_cron')}: ${t('common.every')}${simpleCronValue}${type}更新一次`
`${t('dataset.simple_cron')}: ${t('common.every')}${simpleCronValue}${type}${t(
'data_source.update_once'
)}`
)
strArr.push(`${t('dataset.start_time')}: ${start}`)
strArr.push(`${t('dataset.end_time')}: ${end}`)
@ -413,21 +415,21 @@ const infoList = computed(() => {
})
const saveDsFolder = (params, successCb, finallyCb, cmd) => {
let method = move
let message = '移动成功'
let message = t('data_set.moved_successfully')
switch (cmd) {
case 'move':
method = move
message = '移动成功'
message = t('data_set.moved_successfully')
break
case 'rename':
method = reName
message = '重命名成功'
message = t('data_set.rename_successful')
break
default:
method = createFolder
message = '新建成功'
message = t('data_source.create_successfully')
break
}
method(params)
@ -496,20 +498,20 @@ const dfsDatasourceTree = (ds, id) => {
const creatDsFolder = ref()
const sortList = [
{
name: '按创建时间升序',
name: t('data_source.by_creation_time'),
value: 'time_asc'
},
{
name: '按创建时间降序',
name: t('data_source.by_creation_time_de'),
value: 'time_desc',
divided: true
},
{
name: '按照名称升序',
name: t('data_source.order_by_name'),
value: 'name_asc'
},
{
name: '按照名称降序',
name: t('data_source.order_by_name_de'),
value: 'name_desc'
}
]
@ -755,7 +757,7 @@ const handleCopy = async data => {
lastSyncTime
})
datasource.id = ''
datasource.name = '复制数据源'
datasource.name = t('datasource.copy')
if (datasource.type === 'API') {
for (let i = 0; i < datasource.apiConfiguration.length; i++) {
datasource.apiConfiguration[i].deTableName = ''
@ -790,7 +792,7 @@ const operation = (cmd: string, data: Tree, nodeType: string) => {
showClose: false
}
if (!!data.children?.length) {
options.tip = '删除后,此文件夹下的所有资源都会被删除,请谨慎操作。'
options.tip = t('data_source.operate_with_caution')
} else {
delete options.tip
}
@ -810,16 +812,16 @@ const operation = (cmd: string, data: Tree, nodeType: string) => {
confirmButtonType: 'danger',
type: 'warning',
autofocus: false,
confirmButtonText: '确定',
confirmButtonText: t('common.sure'),
showClose: false,
dangerouslyUseHTMLString: true,
message: h('div', null, [
h('p', { style: 'margin-bottom: 8px;' }, '确定删除该数据源吗?'),
h('p', { class: 'tip' }, '有数据集正在使用此数据源,删除后数据集不可用,确认删除?'),
h('p', { style: 'margin-bottom: 8px;' }, t('datasource.this_data_source')),
h('p', { class: 'tip' }, t('data_source.confirm_to_delete')),
h(
ElButton,
{ text: true, onClick: onClick, style: 'margin-left: -4px;' },
'查看血缘关系'
t('data_source.view_blood_relationship')
)
])
}).then(() => {
@ -847,15 +849,17 @@ const operation = (cmd: string, data: Tree, nodeType: string) => {
}
})
} else {
ElMessageBox.confirm('确定删除该文件夹吗', options as ElMessageBoxOptions).then(() => {
deleteById(data.id as number).then(() => {
if (data.id === nodeInfo.id) {
Object.assign(nodeInfo, cloneDeep(defaultInfo))
}
listDs()
ElMessage.success(t('dataset.delete_success'))
})
})
ElMessageBox.confirm(t('data_set.delete_this_folder'), options as ElMessageBoxOptions).then(
() => {
deleteById(data.id as number).then(() => {
if (data.id === nodeInfo.id) {
Object.assign(nodeInfo, cloneDeep(defaultInfo))
}
listDs()
ElMessage.success(t('dataset.delete_success'))
})
}
)
}
} else {
creatDsFolder.value.createInit(nodeType, data, cmd)
@ -997,7 +1001,7 @@ const getMenuList = (val: boolean) => {
<div class="icon-methods">
<span class="title"> {{ t('datasource.datasource') }} </span>
<div v-if="rootManage" class="flex-align-center">
<el-tooltip effect="dark" content="新建文件夹" placement="top">
<el-tooltip effect="dark" :content="t('deDataset.new_folder')" placement="top">
<el-icon
class="custom-icon btn"
:style="{ marginRight: '20px' }"
@ -1127,7 +1131,7 @@ const getMenuList = (val: boolean) => {
}"
>
<template v-if="!state.datasourceTree.length && mounted">
<empty-background description="暂无数据源" img-type="none">
<empty-background :description="t('data_source.no_data_source')" img-type="none">
<el-button v-if="rootManage" @click="() => createDatasource()" type="primary">
<template #icon>
<Icon name="icon_add_outlined"><icon_add_outlined class="svg-icon" /></Icon>
@ -1169,7 +1173,7 @@ const getMenuList = (val: boolean) => {
><icon_dataset_outlined class="svg-icon"
/></Icon>
</template>
新建数据集
{{ t('data_set.a_new_dataset') }}
</el-button>
<el-button
v-if="nodeInfo.type !== 'Excel' && nodeInfo.weight >= 7"
@ -1198,7 +1202,7 @@ const getMenuList = (val: boolean) => {
><icon_edit_outlined class="svg-icon"
/></Icon>
</template>
替换数据
{{ t('data_source.replace_data') }}
</el-button>
</template>
</el-upload>
@ -1221,7 +1225,7 @@ const getMenuList = (val: boolean) => {
><icon_newItem_outlined class="svg-icon"
/></Icon>
</template>
追加数据
{{ t('data_source.append_data') }}
</el-button>
</template>
</el-upload>
@ -1230,7 +1234,7 @@ const getMenuList = (val: boolean) => {
<template #icon>
<Icon name="icon_edit_outlined"><icon_edit_outlined class="svg-icon" /></Icon>
</template>
编辑
{{ t('chart.edit') }}
</el-button>
</div>
</div>
@ -1277,7 +1281,7 @@ const getMenuList = (val: boolean) => {
key="status"
prop="status"
v-if="['api'].includes(nodeInfo.type.toLowerCase())"
label="最近更新状态"
:label="t('data_source.latest_update_status')"
>
<template #default="scope">
<div class="flex-align-center">
@ -1307,7 +1311,7 @@ const getMenuList = (val: boolean) => {
key="lastUpdateTime"
prop="lastUpdateTime"
v-if="['excel', 'api'].includes(nodeInfo.type.toLowerCase())"
label="最近更新时间"
:label="t('data_source.latest_update_time')"
>
<template v-slot:default="scope">
<span>{{ timestampFormatDate(scope.row.lastUpdateTime) }}</span>
@ -1320,7 +1324,7 @@ const getMenuList = (val: boolean) => {
width="108"
>
<template #default="scope">
<el-tooltip effect="dark" content="新建数据集" placement="top">
<el-tooltip effect="dark" :content="t('data_set.a_new_dataset')" placement="top">
<el-button
@click.stop="createDataset(scope.row.tableName)"
text
@ -1364,7 +1368,7 @@ const getMenuList = (val: boolean) => {
</el-row>
<el-row :gutter="24">
<el-col v-if="nodeInfo.type === 'Excel'" :span="12">
<BaseInfoItem label="文件">
<BaseInfoItem :label="t('data_source.document')">
<ExcelInfo :name="nodeInfo.fileName" :size="nodeInfo.size"></ExcelInfo>
</BaseInfoItem>
</el-col>
@ -1428,7 +1432,7 @@ const getMenuList = (val: boolean) => {
"
class="de-expand"
@click="showSSH = !showSSH"
>SSH 设置
>{{ t('data_source.ssh_settings') }}
<el-icon>
<Icon
><component
@ -1441,15 +1445,19 @@ const getMenuList = (val: boolean) => {
<template v-if="showSSH">
<el-row :gutter="24" v-if="nodeInfo.configuration.useSSH">
<el-col :span="12">
<BaseInfoItem label="主机">{{ nodeInfo.configuration.sshHost }}</BaseInfoItem>
<BaseInfoItem :label="t('data_source.host')">{{
nodeInfo.configuration.sshHost
}}</BaseInfoItem>
</el-col>
<el-col :span="12">
<BaseInfoItem label="端口">{{ nodeInfo.configuration.sshPort }}</BaseInfoItem>
<BaseInfoItem :label="t('data_source.port')">{{
nodeInfo.configuration.sshPort
}}</BaseInfoItem>
</el-col>
</el-row>
<el-row :gutter="24" v-if="nodeInfo.configuration.useSSH">
<el-col :span="12">
<BaseInfoItem label="用户名">{{
<BaseInfoItem :label="t('datasource.user_name')">{{
nodeInfo.configuration.sshUserName
}}</BaseInfoItem>
</el-col>
@ -1543,7 +1551,10 @@ const getMenuList = (val: boolean) => {
</el-row>
<el-row>
<el-col :span="19">
<span>数据时间 {{ timestampFormatDate(api['updateTime']) }}</span>
<span
>{{ t('data_source.data_time') }}
{{ timestampFormatDate(api['updateTime']) }}</span
>
</el-col>
</el-row>
@ -1563,7 +1574,7 @@ const getMenuList = (val: boolean) => {
<template #icon>
<icon name="icon_replace_outlined"><icon_replace_outlined class="svg-icon" /></icon>
</template>
全部更新
{{ t('data_source.update_all') }}
</el-button>
</BaseInfoContent>
<BaseInfoContent
@ -1626,7 +1637,7 @@ const getMenuList = (val: boolean) => {
fixed
><template #empty>
<empty-background
description="暂无数据"
:description="t('data_set.no_data')"
img-type="noneWhite"
/> </template
></el-table-v2>
@ -1639,7 +1650,7 @@ const getMenuList = (val: boolean) => {
</template>
</template>
<template v-else-if="mounted">
<empty-background description="请在左侧选择数据源" img-type="select" />
<empty-background :description="t('data_source.on_the_left')" img-type="select" />
</template>
</div>
<EditorDatasource @refresh="refresh" ref="datasourceEditor"></EditorDatasource>
@ -1749,7 +1760,7 @@ const getMenuList = (val: boolean) => {
<span>{{ timestampFormatDate(scope.row.endTime) }}</span>
</template>
</el-table-column>
<el-table-column prop="taskStatus" label="更新结果">
<el-table-column prop="taskStatus" :label="t('data_source.update_result')">
<template #default="scope">
<div class="flex-align-center">
<template v-if="scope.row.taskStatus === 'Completed'">
@ -1784,7 +1795,7 @@ const getMenuList = (val: boolean) => {
v-model="dialogErrorInfo"
:close-on-press-escape="false"
:close-on-click-modal="false"
title="失败详情"
:title="t('data_source.failure_details')"
width="600px"
>
<span>{{ dialogMsg }}</span>