diff --git a/core/core-frontend/src/custom-component/de-screen/DeTabPreview.vue b/core/core-frontend/src/custom-component/de-screen/DeTabPreview.vue index 0a8d203dd1..3ae88d9d70 100644 --- a/core/core-frontend/src/custom-component/de-screen/DeTabPreview.vue +++ b/core/core-frontend/src/custom-component/de-screen/DeTabPreview.vue @@ -1,11 +1,5 @@ - - + - - - + diff --git a/core/core-frontend/src/locales/en.ts b/core/core-frontend/src/locales/en.ts index 32dc2321fd..bcbfd5659c 100644 --- a/core/core-frontend/src/locales/en.ts +++ b/core/core-frontend/src/locales/en.ts @@ -4836,11 +4836,7 @@ export default { content_type: 'Content Type', del_confirm: 'Are you sure you want to delete this Webhook?', batch_del_confirm: 'Are you sure you want to delete {0} Webhooks?' - } -} - - - // Element Plus internationalization configuration + }, element_plus: { el: { pagination: { @@ -4854,7 +4850,8 @@ export default { currentPage: 'page {pager}', prevPages: 'Previous {pager} pages', nextPages: 'Next {pager} pages', - deprecationWarning: 'Deprecated usages detected, please refer to the el-pagination documentation for more details', + deprecationWarning: + 'Deprecated usages detected, please refer to the el-pagination documentation for more details' } } } diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index f9d9ed9d0f..085b16cbd6 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -4693,21 +4693,20 @@ export default { del_confirm: '确定删除该 Webhook吗?', batch_del_confirm: '确定删除 {0} 个 Webhook吗' }, - // Element Plus internationalization configuration element_plus: { el: { pagination: { - goto: "前往", - pagesize: "条/页", - total: "共 {total} 条", - pageClassifier: "页", - page: "页", - prev: "上一页", - next: "下一页", - currentPage: "第 {pager} 页", - prevPages: "向前 {pager} 页", - nextPages: "向后 {pager} 页", - deprecationWarning: "检测到已弃用的用法,请参阅 el-pagination 文档以了解更多详情" + goto: '前往', + pagesize: '条/页', + total: '共 {total} 条', + pageClassifier: '页', + page: '页', + prev: '上一页', + next: '下一页', + currentPage: '第 {pager} 页', + prevPages: '向前 {pager} 页', + nextPages: '向后 {pager} 页', + deprecationWarning: '检测到已弃用的用法,请参阅 el-pagination 文档以了解更多详情' } } } diff --git a/core/core-frontend/src/plugins/element-plus/index.ts b/core/core-frontend/src/plugins/element-plus/index.ts index 08552f4d66..477571f3e3 100644 --- a/core/core-frontend/src/plugins/element-plus/index.ts +++ b/core/core-frontend/src/plugins/element-plus/index.ts @@ -1,10 +1,10 @@ import type { App } from 'vue' -import { locale } from 'element-plus-secondary' // 需要全局引入一些组件,如ElScrollbar,不然一些下拉项样式有问题 import { ElLoading, ElScrollbar } from 'element-plus-secondary' import * as ElementPlusIconsVue from '@element-plus/icons-vue' import 'element-plus-secondary/theme-chalk/el-radio-button.css' +import { ElConfigProvider } from 'element-plus-secondary' const plugins = [ElLoading] @@ -27,7 +27,7 @@ export const setupElementPlusIcons = (app: App) => { } } -// 导出Element Plus国际化配置函数 +// 修改 setElementPlusLocale 函数以使用 ElConfigProvider 设置国际化 export const setElementPlusLocale = (localeObj: any) => { - locale(localeObj) + ElConfigProvider.locale = localeObj } diff --git a/core/core-frontend/src/store/modules/locale.ts b/core/core-frontend/src/store/modules/locale.ts index e7848c2e59..1a99b309ea 100644 --- a/core/core-frontend/src/store/modules/locale.ts +++ b/core/core-frontend/src/store/modules/locale.ts @@ -11,11 +11,15 @@ import { setElementPlusLocale } from '@/plugins/element-plus' // 合并DataEase的国际化配置到Element Plus的国际化结构中 const mergeLocaleData = (baseLocale: any, customData: any) => { const merged = JSON.parse(JSON.stringify(baseLocale || {})) - + const mergeRecursive = (obj: any, source: any) => { for (const key in source) { if (source.hasOwnProperty(key)) { - if (typeof source[key] === 'object' && source[key] !== null && !Array.isArray(source[key])) { + if ( + typeof source[key] === 'object' && + source[key] !== null && + !Array.isArray(source[key]) + ) { if (!obj[key]) obj[key] = {} mergeRecursive(obj[key], source[key]) } else { @@ -25,7 +29,7 @@ const mergeLocaleData = (baseLocale: any, customData: any) => { } return obj } - + return mergeRecursive(merged, customData) } @@ -122,10 +126,10 @@ export const useLocaleStore = defineStore('locales', { this.currentLocale.lang = localeMap?.lang const baseLocale = elLocaleMap[localeMap?.lang] const customData = await loadCustomLocaleData(localeMap?.lang) - + // 合并基础国际化配置和自定义配置 this.currentLocale.elLocale = mergeLocaleData(baseLocale, customData) - + // 同时更新Element Plus的国际化配置 if (this.currentLocale.elLocale) { setElementPlusLocale(this.currentLocale.elLocale) @@ -136,10 +140,10 @@ export const useLocaleStore = defineStore('locales', { this.currentLocale.lang = language const baseLocale = elLocaleMap[language] const customData = await loadCustomLocaleData(language) - + // 合并基础国际化配置和自定义配置 this.currentLocale.elLocale = mergeLocaleData(baseLocale, customData) - + // 同时更新Element Plus的国际化配置 if (this.currentLocale.elLocale) { setElementPlusLocale(this.currentLocale.elLocale)