fix: 翻译错误

This commit is contained in:
taojinlong
2026-02-02 13:55:53 +08:00
committed by taojinlong
parent d4c41a673c
commit a408fba5fc
5 changed files with 31 additions and 37 deletions

View File

@@ -1,11 +1,5 @@
<script setup lang="ts">
<script setup lang="ts"></script>
</script>
<template></template>
<template>
</template>
<style scoped lang="less">
</style>
<style scoped lang="less"></style>

View File

@@ -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'
}
}
}

View File

@@ -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 文档以了解更多详情'
}
}
}

View File

@@ -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>) => {
}
}
// 导出Element Plus国际化配置函数
// 修改 setElementPlusLocale 函数以使用 ElConfigProvider 设置国际化
export const setElementPlusLocale = (localeObj: any) => {
locale(localeObj)
ElConfigProvider.locale = localeObj
}

View File

@@ -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)