From 3d48aa8bbef37844876853f3a8fd3705aa22ff8c Mon Sep 17 00:00:00 2001 From: cc Date: Sat, 13 May 2023 12:58:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(projects):=20=E5=A2=9E=E5=8A=A0i18n?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=BF=BB=E8=AF=91=E8=8F=9C=E5=8D=95,tab,titl?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 12 +++++++ .../components/global-breadcrumb.vue | 7 ++-- .../global-header/components/header-menu.vue | 3 +- .../common/global-header/components/index.ts | 4 ++- .../global-header/components/toggle-lang.vue | 33 +++++++++++++++++++ src/layouts/common/global-header/index.vue | 4 ++- src/layouts/common/global-logo/index.vue | 14 ++------ .../components/vertical-mix-sider/index.vue | 8 +++-- .../components/vertical-menu.vue | 4 +-- .../components/tab-detail/index.vue | 3 +- src/locales/i18n.ts | 8 +++-- src/router/guard/index.ts | 3 +- src/router/modules/dashboard.ts | 9 +++-- src/store/modules/tab/helpers.ts | 1 - src/typings/route.d.ts | 2 ++ src/typings/storage.d.ts | 2 ++ src/typings/system.d.ts | 3 ++ src/utils/router/breadcrumb.ts | 3 +- src/utils/router/menu.ts | 26 ++++++++++++++- 19 files changed, 116 insertions(+), 33 deletions(-) create mode 100644 src/layouts/common/global-header/components/toggle-lang.vue diff --git a/src/App.vue b/src/App.vue index a801c8557..38294b4c6 100644 --- a/src/App.vue +++ b/src/App.vue @@ -13,14 +13,26 @@ diff --git a/src/layouts/common/global-header/components/global-breadcrumb.vue b/src/layouts/common/global-header/components/global-breadcrumb.vue index e24ab689c..be2e257a8 100644 --- a/src/layouts/common/global-header/components/global-breadcrumb.vue +++ b/src/layouts/common/global-header/components/global-breadcrumb.vue @@ -9,7 +9,7 @@ v-if="theme.header.crumb.showIcon" class="inline-block align-text-bottom mr-4px text-16px" /> - {{ breadcrumb.label }} + {{ breadcrumb.i18nTitle ? t(breadcrumb.i18nTitle) : breadcrumb.label }} @@ -33,6 +35,7 @@ import { routePath } from '@/router'; import { useRouteStore, useThemeStore } from '@/store'; import { useRouterPush } from '@/composables'; import { getBreadcrumbByRouteKey } from '@/utils'; +import { t } from '@/locales'; defineOptions({ name: 'GlobalBreadcrumb' }); diff --git a/src/layouts/common/global-header/components/header-menu.vue b/src/layouts/common/global-header/components/header-menu.vue index e19cd64c7..e67550c15 100644 --- a/src/layouts/common/global-header/components/header-menu.vue +++ b/src/layouts/common/global-header/components/header-menu.vue @@ -20,6 +20,7 @@ import { useRoute } from 'vue-router'; import type { MenuOption } from 'naive-ui'; import { useRouteStore, useThemeStore } from '@/store'; import { useRouterPush } from '@/composables'; +import { translateMenuLabel } from '@/utils'; defineOptions({ name: 'HeaderMenu' }); @@ -28,7 +29,7 @@ const routeStore = useRouteStore(); const theme = useThemeStore(); const { routerPush } = useRouterPush(); -const menus = computed(() => routeStore.menus as App.GlobalMenuOption[]); +const menus = computed(() => translateMenuLabel(routeStore.menus as App.GlobalMenuOption[])); const activeKey = computed(() => (route.meta?.activeMenu ? route.meta.activeMenu : route.name) as string); function handleUpdateMenu(_key: string, item: MenuOption) { diff --git a/src/layouts/common/global-header/components/index.ts b/src/layouts/common/global-header/components/index.ts index f358911ad..3443505e4 100644 --- a/src/layouts/common/global-header/components/index.ts +++ b/src/layouts/common/global-header/components/index.ts @@ -7,6 +7,7 @@ import ThemeMode from './theme-mode.vue'; import UserAvatar from './user-avatar.vue'; import SystemMessage from './system-message.vue'; import SettingButton from './setting-button.vue'; +import ToggleLang from './toggle-lang.vue'; export { MenuCollapse, @@ -17,5 +18,6 @@ export { ThemeMode, UserAvatar, SystemMessage, - SettingButton + SettingButton, + ToggleLang }; diff --git a/src/layouts/common/global-header/components/toggle-lang.vue b/src/layouts/common/global-header/components/toggle-lang.vue new file mode 100644 index 000000000..d5e8e2f9e --- /dev/null +++ b/src/layouts/common/global-header/components/toggle-lang.vue @@ -0,0 +1,33 @@ + + + + diff --git a/src/layouts/common/global-header/index.vue b/src/layouts/common/global-header/index.vue index c25dd1c6e..4c66c4c04 100644 --- a/src/layouts/common/global-header/index.vue +++ b/src/layouts/common/global-header/index.vue @@ -11,6 +11,7 @@ + @@ -32,7 +33,8 @@ import { SettingButton, SystemMessage, ThemeMode, - UserAvatar + UserAvatar, + ToggleLang } from './components'; defineOptions({ name: 'GlobalHeader' }); diff --git a/src/layouts/common/global-logo/index.vue b/src/layouts/common/global-logo/index.vue index a5a25b294..d4c592c25 100644 --- a/src/layouts/common/global-logo/index.vue +++ b/src/layouts/common/global-logo/index.vue @@ -1,11 +1,7 @@ - {{ item.meta.title }} + {{ item.meta.i18nTitle ? t(item.meta.i18nTitle) : item.meta.title }} { // 设置document title - useTitle(to.meta.title); + useTitle(to.meta.i18nTitle ? t(to.meta.i18nTitle) : to.meta.title); // 结束 loadingBar window.$loadingBar?.finish(); }); diff --git a/src/router/modules/dashboard.ts b/src/router/modules/dashboard.ts index 3243b7438..82a863c04 100644 --- a/src/router/modules/dashboard.ts +++ b/src/router/modules/dashboard.ts @@ -10,7 +10,8 @@ const dashboard: AuthRoute.Route = { meta: { title: '分析页', requiresAuth: true, - icon: 'icon-park-outline:analysis' + icon: 'icon-park-outline:analysis', + i18nTitle: 'message.routes.dashboard.analysis' } }, { @@ -20,14 +21,16 @@ const dashboard: AuthRoute.Route = { meta: { title: '工作台', requiresAuth: true, - icon: 'icon-park-outline:workbench' + icon: 'icon-park-outline:workbench', + i18nTitle: 'message.routes.dashboard.workbench' } } ], meta: { title: '仪表盘', icon: 'mdi:monitor-dashboard', - order: 1 + order: 1, + i18nTitle: 'message.routes.dashboard.dashboard' } }; diff --git a/src/store/modules/tab/helpers.ts b/src/store/modules/tab/helpers.ts index d5833625a..87ed21588 100644 --- a/src/store/modules/tab/helpers.ts +++ b/src/store/modules/tab/helpers.ts @@ -7,7 +7,6 @@ import { localStg } from '@/utils'; */ export function getTabRouteByVueRoute(route: RouteRecordNormalized | RouteLocationNormalizedLoaded) { const fullPath = hasFullPath(route) ? route.fullPath : route.path; - const tabRoute: App.GlobalTabRoute = { name: route.name, fullPath, diff --git a/src/typings/route.d.ts b/src/typings/route.d.ts index 0235dbe48..a40004f76 100644 --- a/src/typings/route.d.ts +++ b/src/typings/route.d.ts @@ -31,6 +31,8 @@ declare namespace AuthRoute { interface RouteMeta { /** 路由标题(可用来作document.title或者菜单的名称) */ title: string; + /** 用来支持多国语言 如果i18nTitle和title同时存在优先使用i18nTitle */ + i18nTitle?: string; /** 路由的动态路径(需要动态路径的页面需要将path添加进范型参数) */ dynamicPath?: AuthRouteUtils.GetDynamicPath; /** 作为单级路由的父级路由布局组件 */ diff --git a/src/typings/storage.d.ts b/src/typings/storage.d.ts index 892a7167d..7d343a528 100644 --- a/src/typings/storage.d.ts +++ b/src/typings/storage.d.ts @@ -18,5 +18,7 @@ declare namespace StorageInterface { themeSettings: Theme.Setting; /** 多页签路由信息 */ multiTabRoutes: App.GlobalTabRoute[]; + /** 本地语言缓存 */ + lang: I18nType.langType; } } diff --git a/src/typings/system.d.ts b/src/typings/system.d.ts index cb88b031c..f9b1936e3 100644 --- a/src/typings/system.d.ts +++ b/src/typings/system.d.ts @@ -242,6 +242,7 @@ declare namespace App { routePath: string; icon?: () => import('vue').VNodeChild; children?: GlobalMenuOption[]; + i18nTitle?: string; }; /** 面包屑 */ @@ -252,6 +253,7 @@ declare namespace App { routeName: string; hasChildren: boolean; icon?: import('vue').Component; + i18nTitle?: string; options?: import('naive-ui/es/dropdown/src/interface').DropdownMixedOption[]; }; @@ -300,6 +302,7 @@ declare namespace App { } declare namespace I18nType { + type langType = 'en' | 'zh-CN'; interface Schema { system: { title: string; diff --git a/src/utils/router/breadcrumb.ts b/src/utils/router/breadcrumb.ts index 2955f5d45..19640264b 100644 --- a/src/utils/router/breadcrumb.ts +++ b/src/utils/router/breadcrumb.ts @@ -59,7 +59,8 @@ function transformBreadcrumbMenuToBreadcrumb(menu: App.GlobalMenuOption, rootPat label: menu.label as string, routeName: menu.routeName, disabled: menu.routePath === rootPath, - hasChildren + hasChildren, + i18nTitle: menu.i18nTitle }; if (menu.icon) { breadcrumb.icon = menu.icon; diff --git a/src/utils/router/menu.ts b/src/utils/router/menu.ts index b3eb5dc7b..abed17662 100644 --- a/src/utils/router/menu.ts +++ b/src/utils/router/menu.ts @@ -1,4 +1,5 @@ import { useIconRender } from '@/composables'; +import { t } from '@/locales'; /** * 将权限路由转换成菜单 @@ -18,7 +19,8 @@ export function transformAuthRouteToMenu(routes: AuthRoute.Route[]): App.GlobalM key: routeName, label: meta.title, routeName, - routePath: path + routePath: path, + i18nTitle: meta.i18nTitle }, icon: meta.icon, localIcon: meta.localIcon, @@ -33,6 +35,28 @@ export function transformAuthRouteToMenu(routes: AuthRoute.Route[]): App.GlobalM return globalMenu; } +/** + * 翻译菜单 + * @param menus + * @returns + */ +export function translateMenuLabel(menus: App.GlobalMenuOption[]): App.GlobalMenuOption[] { + const globalMenu: App.GlobalMenuOption[] = []; + menus.forEach(menu => { + let menuChildren: App.GlobalMenuOption[] | undefined; + if (menu.children && menu.children.length > 0) { + menuChildren = translateMenuLabel(menu.children); + } + const menuItem: App.GlobalMenuOption = { + ...menu, + children: menuChildren, + label: menu.i18nTitle ? t(menu.i18nTitle) : menu.label + }; + globalMenu.push(menuItem); + }); + return globalMenu; +} + /** * 获取当前路由所在菜单数据的paths * @param activeKey - 当前路由的key From f68285fbe5b3f166de1ce608a628bada1effc4e6 Mon Sep 17 00:00:00 2001 From: Soybean Date: Sat, 13 May 2023 14:20:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(projects):=20add=20menu=20translate=20?= =?UTF-8?q?[=E7=BF=BB=E8=AF=91=E8=8F=9C=E5=8D=95]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/lang/en.ts | 70 ++++++++++++++++++++++++++++++-- src/locales/lang/zh-cn.ts | 70 ++++++++++++++++++++++++++++++-- src/router/modules/about.ts | 1 + src/router/modules/auth-demo.ts | 3 ++ src/router/modules/component.ts | 4 ++ src/router/modules/document.ts | 6 +++ src/router/modules/exception.ts | 4 ++ src/router/modules/function.ts | 2 + src/router/modules/management.ts | 5 +++ src/router/modules/multi-menu.ts | 5 +++ src/router/modules/plugin.ts | 13 ++++++ src/typings/system.d.ts | 69 ++++++++++++++++++++++++++++++- 12 files changed, 244 insertions(+), 8 deletions(-) diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index c285cc7b1..54dab6e82 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -11,9 +11,73 @@ const locale: LocaleMessages = { analysis: 'Analysis', workbench: 'Workbench' }, - about: { - about: 'About' - } + document: { + _value: 'Document', + vue: 'Vue Document', + vite: 'Vite Document', + naive: 'NaiveUI Document', + project: 'Project Document', + 'project-link': 'Project Document(href)' + }, + component: { + _value: 'Component', + button: 'Button', + card: 'Card', + table: 'Table' + }, + plugin: { + _value: 'Plugin', + charts: { + _value: 'Chart', + echarts: 'ECharts', + antv: 'AntV' + }, + copy: 'Copy', + editor: { + _value: 'Editor', + quill: 'Quill', + markdown: 'Markdown' + }, + icon: 'Icon', + map: 'Map', + print: 'Print', + swiper: 'Swiper', + video: 'Video' + }, + 'auth-demo': { + _value: 'Auth Demo', + permission: 'Toggle Permission', + super: 'Super Auth' + }, + function: { + _value: 'Function', + tab: 'System Tab' + }, + exception: { + _value: 'Exception', + 403: '403', + 404: '404', + 500: '500' + }, + 'multi-menu': { + _value: 'Multi Degree Menu', + first: { + _value: 'First Degree', + second: 'Second Degree', + 'second-new': { + _value: 'Second Degree With Children', + third: 'Third Degree' + } + } + }, + management: { + _value: 'System Management', + auth: 'Auth', + role: 'Role', + route: 'Route', + user: 'User' + }, + about: 'About' } } }; diff --git a/src/locales/lang/zh-cn.ts b/src/locales/lang/zh-cn.ts index 30956e46b..29ff22c79 100644 --- a/src/locales/lang/zh-cn.ts +++ b/src/locales/lang/zh-cn.ts @@ -11,9 +11,73 @@ const locale: LocaleMessages = { analysis: '分析页', workbench: '工作台' }, - about: { - about: '关于' - } + document: { + _value: '文档', + vue: 'Vue文档', + vite: 'Vite文档', + naive: 'NaiveUI文档', + project: '项目文档', + 'project-link': '项目文档(外链)' + }, + component: { + _value: '组件示例', + button: '按钮', + card: '卡片', + table: '表格' + }, + plugin: { + _value: '插件示例', + charts: { + _value: '图表', + echarts: 'ECharts', + antv: 'AntV' + }, + copy: '剪贴板', + editor: { + _value: '编辑器', + quill: '富文本', + markdown: 'Markdown' + }, + icon: '图标', + map: '地图', + print: '打印', + swiper: 'Swiper', + video: '视频' + }, + 'auth-demo': { + _value: '权限示例', + permission: '切换权限', + super: '超级管理员可见' + }, + function: { + _value: '功能', + tab: 'Tab页签' + }, + exception: { + _value: '异常页', + 403: '403', + 404: '404', + 500: '500' + }, + 'multi-menu': { + _value: '多级菜单', + first: { + _value: '一级菜单', + second: '二级菜单', + 'second-new': { + _value: '二级菜单(有子菜单)', + third: '三级菜单' + } + } + }, + management: { + _value: '系统管理', + auth: '权限管理', + role: '角色管理', + route: '路由管理', + user: '用户管理' + }, + about: '关于' } } }; diff --git a/src/router/modules/about.ts b/src/router/modules/about.ts index 015416aa7..4683f4bf6 100644 --- a/src/router/modules/about.ts +++ b/src/router/modules/about.ts @@ -4,6 +4,7 @@ const about1: AuthRoute.Route = { component: 'self', meta: { title: '关于', + i18nTitle: 'message.routes.about', requiresAuth: true, keepAlive: true, singleLayout: 'basic', diff --git a/src/router/modules/auth-demo.ts b/src/router/modules/auth-demo.ts index 60fa64c68..6ce0fe3db 100644 --- a/src/router/modules/auth-demo.ts +++ b/src/router/modules/auth-demo.ts @@ -9,6 +9,7 @@ const authDemo: AuthRoute.Route = { component: 'self', meta: { title: '权限切换', + i18nTitle: 'message.routes.auth-demo.permission', requiresAuth: true, icon: 'ic:round-construction' } @@ -19,6 +20,7 @@ const authDemo: AuthRoute.Route = { component: 'self', meta: { title: '超级管理员可见', + i18nTitle: 'message.routes.auth-demo.super', requiresAuth: true, permissions: ['super'], icon: 'ic:round-supervisor-account' @@ -27,6 +29,7 @@ const authDemo: AuthRoute.Route = { ], meta: { title: '权限示例', + i18nTitle: 'message.routes.auth-demo._value', icon: 'ic:baseline-security', order: 5 } diff --git a/src/router/modules/component.ts b/src/router/modules/component.ts index 6cffaf897..f89746942 100644 --- a/src/router/modules/component.ts +++ b/src/router/modules/component.ts @@ -9,6 +9,7 @@ const component: AuthRoute.Route = { component: 'self', meta: { title: '按钮', + i18nTitle: 'message.routes.component.button', requiresAuth: true, icon: 'mdi:button-cursor' } @@ -19,6 +20,7 @@ const component: AuthRoute.Route = { component: 'self', meta: { title: '卡片', + i18nTitle: 'message.routes.component.card', requiresAuth: true, icon: 'mdi:card-outline' } @@ -29,6 +31,7 @@ const component: AuthRoute.Route = { component: 'self', meta: { title: '表格', + i18nTitle: 'message.routes.component.table', requiresAuth: true, icon: 'mdi:table-large' } @@ -36,6 +39,7 @@ const component: AuthRoute.Route = { ], meta: { title: '组件示例', + i18nTitle: 'message.routes.component._value', icon: 'cib:app-store', order: 3 } diff --git a/src/router/modules/document.ts b/src/router/modules/document.ts index f1590c496..fb18691c5 100644 --- a/src/router/modules/document.ts +++ b/src/router/modules/document.ts @@ -9,6 +9,7 @@ const document: AuthRoute.Route = { component: 'self', meta: { title: 'vue文档', + i18nTitle: 'message.routes.document.vue', requiresAuth: true, icon: 'logos:vue' } @@ -19,6 +20,7 @@ const document: AuthRoute.Route = { component: 'self', meta: { title: 'vite文档', + i18nTitle: 'message.routes.document.vite', requiresAuth: true, icon: 'logos:vitejs' } @@ -29,6 +31,7 @@ const document: AuthRoute.Route = { component: 'self', meta: { title: 'naive文档', + i18nTitle: 'message.routes.document.naive', requiresAuth: true, icon: 'logos:naiveui' } @@ -39,6 +42,7 @@ const document: AuthRoute.Route = { component: 'self', meta: { title: '项目文档', + i18nTitle: 'message.routes.document.project', requiresAuth: true, localIcon: 'logo' } @@ -48,6 +52,7 @@ const document: AuthRoute.Route = { path: '/document/project-link', meta: { title: '项目文档(外链)', + i18nTitle: 'message.routes.document.project-link', requiresAuth: true, localIcon: 'logo', href: 'https://docs.soybean.pro/' @@ -56,6 +61,7 @@ const document: AuthRoute.Route = { ], meta: { title: '文档', + i18nTitle: 'message.routes.document._value', icon: 'mdi:file-document-multiple-outline', order: 2 } diff --git a/src/router/modules/exception.ts b/src/router/modules/exception.ts index b9709937f..3af71757b 100644 --- a/src/router/modules/exception.ts +++ b/src/router/modules/exception.ts @@ -9,6 +9,7 @@ const exception: AuthRoute.Route = { component: 'self', meta: { title: '异常页403', + i18nTitle: 'message.routes.exception.403', requiresAuth: true, icon: 'ic:baseline-block' } @@ -19,6 +20,7 @@ const exception: AuthRoute.Route = { component: 'self', meta: { title: '异常页404', + i18nTitle: 'message.routes.exception.404', requiresAuth: true, icon: 'ic:baseline-web-asset-off' } @@ -29,12 +31,14 @@ const exception: AuthRoute.Route = { component: 'self', meta: { title: '异常页500', + i18nTitle: 'message.routes.exception.500', requiresAuth: true, icon: 'ic:baseline-wifi-off' } } ], meta: { + i18nTitle: 'message.routes.exception._value', title: '异常页', icon: 'ant-design:exception-outlined', order: 7 diff --git a/src/router/modules/function.ts b/src/router/modules/function.ts index a9fcdf56b..0e99c9810 100644 --- a/src/router/modules/function.ts +++ b/src/router/modules/function.ts @@ -9,6 +9,7 @@ const functionRoute: AuthRoute.Route = { component: 'self', meta: { title: 'Tab', + i18nTitle: 'message.routes.function.tab', requiresAuth: true, icon: 'ic:round-tab' } @@ -41,6 +42,7 @@ const functionRoute: AuthRoute.Route = { ], meta: { title: '功能', + i18nTitle: 'message.routes.function._value', icon: 'icon-park-outline:all-application', order: 6 } diff --git a/src/router/modules/management.ts b/src/router/modules/management.ts index c0fd7879f..c84f70b54 100644 --- a/src/router/modules/management.ts +++ b/src/router/modules/management.ts @@ -9,6 +9,7 @@ const management: AuthRoute.Route = { component: 'self', meta: { title: '权限管理', + i18nTitle: 'message.routes.management.auth', requiresAuth: true, icon: 'ic:baseline-security' } @@ -19,6 +20,7 @@ const management: AuthRoute.Route = { component: 'self', meta: { title: '角色管理', + i18nTitle: 'message.routes.management.role', requiresAuth: true, icon: 'carbon:user-role' } @@ -29,6 +31,7 @@ const management: AuthRoute.Route = { component: 'self', meta: { title: '用户管理', + i18nTitle: 'message.routes.management.user', requiresAuth: true, icon: 'ic:round-manage-accounts' } @@ -39,6 +42,7 @@ const management: AuthRoute.Route = { component: 'self', meta: { title: '路由管理', + i18nTitle: 'message.routes.management.route', requiresAuth: true, icon: 'material-symbols:route' } @@ -46,6 +50,7 @@ const management: AuthRoute.Route = { ], meta: { title: '系统管理', + i18nTitle: 'message.routes.management._value', icon: 'carbon:cloud-service-management', order: 9 } diff --git a/src/router/modules/multi-menu.ts b/src/router/modules/multi-menu.ts index 07edbab3e..b16d7fdfb 100644 --- a/src/router/modules/multi-menu.ts +++ b/src/router/modules/multi-menu.ts @@ -14,6 +14,7 @@ const multiMenu: AuthRoute.Route = { component: 'self', meta: { title: '二级菜单', + i18nTitle: 'message.routes.multi-menu.first.second', requiresAuth: true, icon: 'mdi:menu' } @@ -29,6 +30,7 @@ const multiMenu: AuthRoute.Route = { component: 'self', meta: { title: '三级菜单', + i18nTitle: 'message.routes.multi-menu.first.second-new.third', requiresAuth: true, icon: 'mdi:menu' } @@ -36,18 +38,21 @@ const multiMenu: AuthRoute.Route = { ], meta: { title: '二级菜单(有子菜单)', + i18nTitle: 'message.routes.multi-menu.first.second-new._value', icon: 'mdi:menu' } } ], meta: { title: '一级菜单', + i18nTitle: 'message.routes.multi-menu.first._value', icon: 'mdi:menu' } } ], meta: { title: '多级菜单', + i18nTitle: 'message.routes.multi-menu._value', icon: 'carbon:menu', order: 8 } diff --git a/src/router/modules/plugin.ts b/src/router/modules/plugin.ts index a7d13fc05..1fe5ad158 100644 --- a/src/router/modules/plugin.ts +++ b/src/router/modules/plugin.ts @@ -14,6 +14,7 @@ const plugin: AuthRoute.Route = { component: 'self', meta: { title: 'ECharts', + i18nTitle: 'message.routes.plugin.charts.echarts', requiresAuth: true, icon: 'simple-icons:apacheecharts' } @@ -24,6 +25,7 @@ const plugin: AuthRoute.Route = { component: 'self', meta: { title: 'AntV', + i18nTitle: 'message.routes.plugin.charts.antv', requiresAuth: true, icon: 'simple-icons:antdesign' } @@ -31,6 +33,7 @@ const plugin: AuthRoute.Route = { ], meta: { title: '图表', + i18nTitle: 'message.routes.plugin.charts._value', icon: 'mdi:chart-areaspline' } }, @@ -40,6 +43,7 @@ const plugin: AuthRoute.Route = { component: 'self', meta: { title: '地图', + i18nTitle: 'message.routes.plugin.map', requiresAuth: true, icon: 'mdi:map' } @@ -50,6 +54,7 @@ const plugin: AuthRoute.Route = { component: 'self', meta: { title: '视频', + i18nTitle: 'message.routes.plugin.video', requiresAuth: true, icon: 'mdi:video' } @@ -65,6 +70,7 @@ const plugin: AuthRoute.Route = { component: 'self', meta: { title: '富文本编辑器', + i18nTitle: 'message.routes.plugin.editor.quill', requiresAuth: true, icon: 'mdi:file-document-edit-outline' } @@ -75,6 +81,7 @@ const plugin: AuthRoute.Route = { component: 'self', meta: { title: 'markdown编辑器', + i18nTitle: 'message.routes.plugin.editor.markdown', requiresAuth: true, icon: 'ri:markdown-line' } @@ -82,6 +89,7 @@ const plugin: AuthRoute.Route = { ], meta: { title: '编辑器', + i18nTitle: 'message.routes.plugin.editor._value', icon: 'icon-park-outline:editor' } }, @@ -91,6 +99,7 @@ const plugin: AuthRoute.Route = { component: 'self', meta: { title: 'Swiper插件', + i18nTitle: 'message.routes.plugin.swiper', requiresAuth: true, icon: 'simple-icons:swiper' } @@ -101,6 +110,7 @@ const plugin: AuthRoute.Route = { component: 'self', meta: { title: '剪贴板', + i18nTitle: 'message.routes.plugin.copy', requiresAuth: true, icon: 'mdi:clipboard-outline' } @@ -111,6 +121,7 @@ const plugin: AuthRoute.Route = { component: 'self', meta: { title: '图标', + i18nTitle: 'message.routes.plugin.icon', requiresAuth: true, localIcon: 'custom-icon' } @@ -121,6 +132,7 @@ const plugin: AuthRoute.Route = { component: 'self', meta: { title: '打印', + i18nTitle: 'message.routes.plugin.print', requiresAuth: true, icon: 'mdi:printer' } @@ -128,6 +140,7 @@ const plugin: AuthRoute.Route = { ], meta: { title: '插件示例', + i18nTitle: 'message.routes.plugin._value', icon: 'clarity:plugin-line', order: 4 } diff --git a/src/typings/system.d.ts b/src/typings/system.d.ts index f9b1936e3..949f82ef8 100644 --- a/src/typings/system.d.ts +++ b/src/typings/system.d.ts @@ -303,6 +303,7 @@ declare namespace App { declare namespace I18nType { type langType = 'en' | 'zh-CN'; + interface Schema { system: { title: string; @@ -313,9 +314,73 @@ declare namespace I18nType { analysis: string; workbench: string; }; - about: { - about: string; + document: { + _value: string; + vue: string; + vite: string; + naive: string; + project: string; + 'project-link': string; + }; + component: { + _value: string; + button: string; + card: string; + table: string; + }; + plugin: { + _value: string; + charts: { + _value: string; + antv: string; + echarts: string; + }; + copy: string; + editor: { + _value: string; + markdown: string; + quill: string; + }; + icon: string; + map: string; + print: string; + swiper: string; + video: string; + }; + 'auth-demo': { + _value: string; + permission: string; + super: string; + }; + function: { + _value: string; + tab: string; + }; + exception: { + _value: string; + 403: string; + 404: string; + 500: string; + }; + 'multi-menu': { + _value: string; + first: { + _value: string; + second: string; + 'second-new': { + _value: string; + third: string; + }; + }; + }; + management: { + _value: string; + auth: string; + role: string; + route: string; + user: string; }; + about: string; }; } }