From f68285fbe5b3f166de1ce608a628bada1effc4e6 Mon Sep 17 00:00:00 2001 From: Soybean Date: Sat, 13 May 2023 14:20:06 +0800 Subject: [PATCH] =?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 c285cc7b..54dab6e8 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 30956e46..29ff22c7 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 015416aa..4683f4bf 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 60fa64c6..6ce0fe3d 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 6cffaf89..f8974694 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 f1590c49..fb18691c 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 b9709937..3af71757 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 a9fcdf56..0e99c981 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 c0fd7879..c84f70b5 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 07edbab3..b16d7fdf 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 a7d13fc0..1fe5ad15 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 f9b1936e..949f82ef 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; }; } }