From 66704591da9be233ed642f486c22f66cfb8c0ebc Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Thu, 10 Oct 2024 14:28:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=95=B0=E6=8D=AE=E6=BA=90):=20=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/locales/en.ts | 43 +++++++++++++++++ core/core-frontend/src/locales/zh-CN.ts | 43 +++++++++++++++++ .../datasource/form/ApiHttpRequestDraw.vue | 22 +++++---- .../data/datasource/form/ApiKeyValue.vue | 20 ++++---- .../data/datasource/form/ApiVariable.vue | 20 ++++---- .../data/datasource/form/CreatDsGroup.vue | 17 ++++--- .../data/datasource/form/DsTypeList.vue | 4 +- .../data/datasource/form/EditorDetail.vue | 46 +++++++++++-------- 8 files changed, 164 insertions(+), 51 deletions(-) diff --git a/core/core-frontend/src/locales/en.ts b/core/core-frontend/src/locales/en.ts index 4a2d969258..abb1deb34f 100644 --- a/core/core-frontend/src/locales/en.ts +++ b/core/core-frontend/src/locales/en.ts @@ -189,6 +189,49 @@ export default { cannot_be_empty_: 'Filter field cannot be empty', cannot_be_empty_de_ruler: 'Rule condition cannot be empty' }, + data_source: { + 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', + the_data_structure: 'There is no data yet, please check the fields in the data structure', + parameter: 'parameter', + fixed_value: 'fixed value', + time_function: 'time function', + customize: 'Customize', + that_day: 'that day', + value: 'value', + name_use_parameters: 'Available ${parameter name}, use parameters', + add_parameters: 'Add parameters', + data_source_name: 'Data source name', + data_source_name_de: 'Please enter the data source name', + a_folder_name: 'Please enter a folder name', + data_source: 'data source', + the_destination_folder: 'Please select the destination folder', + source_saved_successfully: 'Data source saved successfully', + relevant_content_found: 'No relevant content found', + recently_created: 'Recently created', + cannot_be_empty: 'SSH host cannot be empty', + cannot_be_empty_de: 'SSH port cannot be empty', + cannot_be_empty_de_name: 'SSH username cannot be empty', + cannot_be_empty_de_pwd: 'SSH password cannot be empty', + cannot_be_empty_d_key: 'SSH key cannot be empty', + enter_parameter_name: 'Please enter parameter name', + to_64_characters: 'Parameter names are limited to 2 to 64 characters', + the_interface_name: 'Please enter the interface name', + to_64_characters_de: 'The interface name is limited to 2 to 64 characters.', + sure_to_delete: 'Are you sure to delete?', + rename: 'Rename', + delete: 'delete', + source_configuration_information: 'Data source configuration information', + data_update_settings: 'Data update settings', + connection_method: 'Connection method', + hostname: 'hostname', + jdbc_connection: 'JDBC connection' + }, login: { welcome: 'Welcome', btn: 'Login', diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index 336ad7188c..ec5a8be557 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -206,6 +206,49 @@ export default { cannot_be_empty_: '过滤字段不能为空', cannot_be_empty_de_ruler: '规则条件不能为空' }, + data_source: { + the_request_address: '请输入请求地址', + name_already_exists: '已经存在同名参数:', + name_already_exists_de: '已经存在同名的参数表', + verification_failed: '校验失败', + interface_parameters: '接口参数', + extract_parameters: '提取参数', + view_data_structure: '查看数据结构', + the_data_structure: '暂无数据,请在数据结构勾选字段', + parameter: '参数', + fixed_value: '固定值', + time_function: '时间函数', + customize: '自定义', + that_day: '当天', + value: '值', + name_use_parameters: '可用${参数名},使用参数', + add_parameters: '添加参数', + data_source_name: '数据源名称', + data_source_name_de: '请输入数据源名称', + a_folder_name: '请输入文件夹名称', + data_source: '数据源', + the_destination_folder: '请选择目标文件夹', + source_saved_successfully: '保存数据源成功', + relevant_content_found: '没有找到相关内容', + recently_created: '最近创建', + cannot_be_empty: 'SSH主机不能为空', + cannot_be_empty_de: 'SSH端口不能为空', + cannot_be_empty_de_name: 'SSH用户名不能为空', + cannot_be_empty_de_pwd: 'SSH密码不能为空', + cannot_be_empty_de_key: 'SSH key不能为空', + enter_parameter_name: '请输入参数名称', + to_64_characters: '参数名称限制2~64字符', + the_interface_name: '请输入接口名称', + to_64_characters_de: '接口名称限制2~64字符', + sure_to_delete: '确定删除吗?', + rename: '重命名', + delete: '删除', + source_configuration_information: '数据源配置信息', + data_update_settings: '数据更新设置', + connection_method: '连接方式', + hostname: '主机名', + jdbc_connection: 'JDBC 连接' + }, dynamic_time: { set_default: '设置默认值', fix: '固定时间', diff --git a/core/core-frontend/src/views/visualized/data/datasource/form/ApiHttpRequestDraw.vue b/core/core-frontend/src/views/visualized/data/datasource/form/ApiHttpRequestDraw.vue index a72f7949df..6b926ef8af 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/form/ApiHttpRequestDraw.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/form/ApiHttpRequestDraw.vue @@ -145,7 +145,7 @@ const rule = reactive({ url: [ { required: true, - message: '请输入请求地址', + message: t('data_source.the_request_address'), trigger: 'blur' } ], @@ -229,7 +229,7 @@ const saveItem = () => { apiItem.fields[i].name === paramsList[j].fields[k].name && apiItem.serialNumber !== paramsList[j].serialNumber ) { - ElMessage.error('已经存在同名参数:' + apiItem.fields[i].name) + ElMessage.error(t('data_source.name_already_exists') + apiItem.fields[i].name) return } } @@ -263,7 +263,7 @@ const next = () => { paramsList[i].name === apiItem.name && apiItem.serialNumber !== paramsList[i].serialNumber ) { - ElMessage.error('已经存在同名的参数表') + ElMessage.error(t('data_source.name_already_exists_de')) return } } @@ -321,7 +321,7 @@ const validate = () => { ElMessage.success(t('datasource.validate_success')) }) .catch(() => { - ElMessage.error('校验失败') + ElMessage.error(t('data_source.verification_failed')) }) } }) @@ -444,7 +444,9 @@ defineExpose({ @@ -557,7 +561,9 @@ defineExpose({ @@ -704,7 +710,7 @@ defineExpose({ > diff --git a/core/core-frontend/src/views/visualized/data/datasource/form/ApiKeyValue.vue b/core/core-frontend/src/views/visualized/data/datasource/form/ApiKeyValue.vue index e1e1dad7bc..4856b2e7ab 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/form/ApiKeyValue.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/form/ApiKeyValue.vue @@ -86,30 +86,30 @@ const createFilter = (queryString: string) => { } const options = [ { - label: '参数', + label: t('data_source.parameter'), value: 'params' }, { - label: '固定值', + label: t('data_source.fixed_value'), value: 'fixed' }, { - label: '时间函数', + label: t('data_source.time_function'), value: 'timeFun' }, { - label: '自定义', + label: t('data_source.customize'), value: 'custom' } ] const timeFunLists = [ { - label: '当天(yyyy-MM-dd)', + label: t('data_source.that_day') + '(yyyy-MM-dd)', value: 'currentDay yyyy-MM-dd' }, { - label: '当天(yyyy/MM/dd)', + label: t('data_source.that_day') + '(yyyy/MM/dd)', value: 'currentDay yyyy/MM/dd' } ] @@ -204,7 +204,11 @@ const timeFunLists = [ " v-model="element.value" :disabled="isReadOnly" - :placeholder="element.nameType === 'fixed' ? '值' : '可用${参数名},使用参数'" + :placeholder=" + element.nameType === 'fixed' + ? t('data_source.value') + : t('data_source.name_use_parameters') + " show-word-limit /> @@ -236,7 +240,7 @@ const timeFunLists = [ - 添加参数 + {{ t('data_source.add_parameters') }} diff --git a/core/core-frontend/src/views/visualized/data/datasource/form/ApiVariable.vue b/core/core-frontend/src/views/visualized/data/datasource/form/ApiVariable.vue index 3dfa5f76f5..fe5793c476 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/form/ApiVariable.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/form/ApiVariable.vue @@ -106,29 +106,29 @@ const changeNameType = element => { const activeName = inject('api-active-name') const options = [ { - label: '参数', + label: t('data_source.parameter'), value: 'params' }, { - label: '固定值', + label: t('data_source.fixed_value'), value: 'fixed' }, { - label: '时间函数', + label: t('data_source.time_function'), value: 'timeFun' }, { - label: '自定义', + label: t('data_source.customize'), value: 'custom' } ] const timeFunLists = [ { - label: '当天(yyyy-MM-dd)', + label: t('data_source.that_day') + '(yyyy-MM-dd)', value: 'currentDay yyyy-MM-dd' }, { - label: '当天(yyyy/MM/dd)', + label: t('data_source.that_day') + '(yyyy/MM/dd)', value: 'currentDay yyyy/MM/dd' } ] @@ -230,7 +230,11 @@ const timeFunLists = [ v-model="element.value" :disabled="isReadOnly" class="input-with-autocomplete" - :placeholder="element.nameType === 'fixed' ? '值' : '可用${参数名},使用参数'" + :placeholder=" + element.nameType === 'fixed' + ? t('data_source.value') + : t('data_source.name_use_parameters') + " value-key="name" highlight-first-item /> @@ -262,7 +266,7 @@ const timeFunLists = [ - 添加参数 + {{ t('data_source.add_parameters') }} diff --git a/core/core-frontend/src/views/visualized/data/datasource/form/CreatDsGroup.vue b/core/core-frontend/src/views/visualized/data/datasource/form/CreatDsGroup.vue index e37468e84a..40fc972b0a 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/form/CreatDsGroup.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/form/CreatDsGroup.vue @@ -70,7 +70,9 @@ const showPid = computed(() => { }) const labelName = computed(() => { - return nodeType.value === 'folder' ? t('deDataset.folder_name') : '数据源名称' + return nodeType.value === 'folder' + ? t('deDataset.folder_name') + : t('data_source.data_source_name') }) const dialogTitle = computed(() => { @@ -135,7 +137,8 @@ const createInit = (type, data: Tree, exec, name: string) => { datasetForm.name = '' nodeType.value = type filterText.value = '' - placeholder.value = type === 'folder' ? '请输入文件夹名称' : '请输入数据源名称' + placeholder.value = + type === 'folder' ? t('data_source.a_folder_name') : t('data_source.data_source_name_de') dsType = data.type if (type === 'datasource') { request = data.request @@ -146,7 +149,7 @@ const createInit = (type, data: Tree, exec, name: string) => { dfs(res as unknown as Tree[]) state.tData = (res as unknown as Tree[]) || [] if (state.tData.length && state.tData[0].name === 'root' && state.tData[0].id === '0') { - state.tData[0].name = '数据源' + state.tData[0].name = t('data_source.data_source') } }) } @@ -226,7 +229,7 @@ const finallyCb = () => { } const checkPid = pid => { if (pid !== 0 && !pid) { - ElMessage.error('请选择目标文件夹') + ElMessage.error(t('data_source.the_destination_folder')) return false } return true @@ -284,7 +287,7 @@ const saveDataset = () => { if (res !== undefined) { wsCache.set('ds-new-success', true) emits('handleShowFinishPage', { ...res, pid: params.pid }) - ElMessage.success('保存数据源成功') + ElMessage.success(t('data_source.source_saved_successfully')) successCb() } }) @@ -302,7 +305,7 @@ const saveDataset = () => { if (res !== undefined) { wsCache.set('ds-new-success', true) emits('handleShowFinishPage', { ...res, pid: params.pid }) - ElMessage.success('保存数据源成功') + ElMessage.success(t('data_source.source_saved_successfully')) successCb() } }) @@ -399,7 +402,7 @@ const emits = defineEmits(['finish', 'handleShowFinishPage']) diff --git a/core/core-frontend/src/views/visualized/data/datasource/form/DsTypeList.vue b/core/core-frontend/src/views/visualized/data/datasource/form/DsTypeList.vue index d559edc84a..4e067df4a6 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/form/DsTypeList.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/form/DsTypeList.vue @@ -4,6 +4,7 @@ import { dsTypes, typeList, nameMap } from './option' import Icon from '@/components/icon-custom/src/Icon.vue' import { XpackComponent } from '@/components/plugin' import { iconDatasourceMap } from '@/components/icon-group/datasource-list' +import { useI18n } from '@/hooks/web/useI18n' export type DsType = 'OLTP' | 'OLAP' | 'DL' | 'OTHER' | 'LOCAL' | 'latestUse' | 'all' const props = defineProps({ @@ -19,6 +20,7 @@ const props = defineProps({ type: Array } }) +const { t } = useI18n() const databaseList = shallowRef([]) const currentTypeList = computed(() => { @@ -53,7 +55,7 @@ const currentTypeList = computed(() => { }) }) dbList = dbList.filter(ele => ele.name.toLowerCase().includes(props.filterText.trim())) - dstypes.push({ name: '最近创建', dbList }) + dstypes.push({ name: t('data_source.recently_created'), dbList }) return dstypes } const index = typeList.findIndex(ele => props.currentType === ele) diff --git a/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue b/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue index 43ca3f27e8..1dc43ff9a2 100644 --- a/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue +++ b/core/core-frontend/src/views/visualized/data/datasource/form/EditorDetail.vue @@ -173,21 +173,21 @@ const authMethodList = [ const validateSshHost = (_: any, value: any, callback: any) => { if ((value === undefined || value === null || value === '') && form.value.configuration.useSSH) { - callback(new Error('SSH主机不能为空')) + callback(new Error(t('data_source.cannot_be_empty'))) } return callback() } const validateSshPort = (_: any, value: any, callback: any) => { if ((value === undefined || value === null || value === '') && form.value.configuration.useSSH) { - callback(new Error('SSH端口不能为空')) + callback(new Error(t('data_source.cannot_be_empty_de'))) } return callback() } const validateSshUserName = (_: any, value: any, callback: any) => { if ((value === undefined || value === null || value === '') && form.value.configuration.useSSH) { - callback(new Error('SSH用户名不能为空')) + callback(new Error(t('data_source.cannot_be_empty_de_name'))) } return callback() } @@ -198,7 +198,7 @@ const validateSshPassword = (_: any, value: any, callback: any) => { form.value.configuration.useSSH && form.value.configuration.sshType === 'password' ) { - callback(new Error('SSH密码不能为空')) + callback(new Error(t('data_source.cannot_be_empty_de_pwd'))) } return callback() } @@ -209,7 +209,7 @@ const validateSshkey = (_: any, value: any, callback: any) => { form.value.configuration.useSSH && form.value.configuration.sshType === 'sshkey' ) { - callback(new Error('SSH key不能为空')) + callback(new Error(t('data_source.cannot_be_empty_de_key'))) } return callback() } @@ -586,13 +586,13 @@ const paramsObjRules = { name: [ { required: true, - message: '请输入参数名称', + message: t('data_source.enter_parameter_name'), trigger: 'change' }, { min: 2, max: 64, - message: '参数名称限制2~64字符', + message: t('data_source.to_64_characters'), trigger: 'blur' } ] @@ -602,13 +602,13 @@ const apiObjRules = { name: [ { required: true, - message: '请输入接口名称', + message: t('data_source.the_interface_name'), trigger: 'change' }, { min: 2, max: 64, - message: '接口名称限制2~64字符', + message: t('data_source.to_64_characters_de'), trigger: 'blur' } ] @@ -663,7 +663,7 @@ const handleApiParams = (cmd: string, data) => { apiObj.value.serialNumber = data.serialNumber } if (cmd === 'delete') { - ElMessageBox.confirm('确定删除吗?', { + ElMessageBox.confirm(t('data_source.sure_to_delete'), { confirmButtonType: 'danger', type: 'warning', autofocus: false, @@ -691,7 +691,7 @@ const editParams = data => { } const delParams = data => { - ElMessageBox.confirm('确定删除吗?', { + ElMessageBox.confirm(t('data_source.sure_to_delete'), { confirmButtonType: 'danger', type: 'warning', autofocus: false, @@ -702,12 +702,12 @@ const delParams = data => { } const datasetTypeList = [ { - label: '重命名', + label: t('data_source.rename'), svgName: icon_rename_outlined, command: 'rename' }, { - label: '删除', + label: t('data_source.delete'), svgName: icon_deleteTrash_outlined, command: 'delete' } @@ -724,9 +724,13 @@ defineExpose({
-
数据源配置信息
+
+ {{ t('data_source.source_configuration_information') }} +
-
数据更新设置
+
+ {{ t('data_source.data_update_settings') }} +
{{ t('datasource.basic_info') }} @@ -766,7 +770,7 @@ defineExpose({
- +