mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-30 23:26:41 +08:00
fix: i18n
This commit is contained in:
parent
b632b7ffed
commit
29ee2dc144
@ -4,7 +4,7 @@ root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = tab
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespace = true
|
||||
|
@ -10,7 +10,7 @@ export const routeModel: Record<Auth.RoleType, AuthRoute.Route[]> = {
|
||||
path: '/dashboard/analysis',
|
||||
component: 'self',
|
||||
meta: {
|
||||
title: '分析页',
|
||||
title: 'message.routes.dashboard.analysis',
|
||||
requiresAuth: true,
|
||||
icon: 'icon-park-outline:analysis'
|
||||
}
|
||||
@ -20,14 +20,14 @@ export const routeModel: Record<Auth.RoleType, AuthRoute.Route[]> = {
|
||||
path: '/dashboard/workbench',
|
||||
component: 'self',
|
||||
meta: {
|
||||
title: '工作台',
|
||||
title: 'message.routes.dashboard.workbench',
|
||||
requiresAuth: true,
|
||||
icon: 'icon-park-outline:workbench'
|
||||
}
|
||||
}
|
||||
],
|
||||
meta: {
|
||||
title: '仪表盘',
|
||||
title: 'message.routes.dashboard.dashboard',
|
||||
icon: 'mdi:monitor-dashboard',
|
||||
order: 1
|
||||
}
|
||||
@ -502,7 +502,7 @@ export const routeModel: Record<Auth.RoleType, AuthRoute.Route[]> = {
|
||||
path: '/about',
|
||||
component: 'self',
|
||||
meta: {
|
||||
title: '关于',
|
||||
title: 'message.routes.about.about',
|
||||
requiresAuth: true,
|
||||
singleLayout: 'basic',
|
||||
icon: 'fluent:book-information-24-regular',
|
||||
|
@ -18,7 +18,7 @@
|
||||
:local-icon="item.meta.localIcon"
|
||||
class="inline-block align-text-bottom mr-4px text-16px"
|
||||
/>
|
||||
{{ item.meta.title }}
|
||||
{{ t(item.meta.title) }}
|
||||
</component>
|
||||
</div>
|
||||
<context-menu
|
||||
@ -34,6 +34,7 @@
|
||||
import { computed, nextTick, reactive, ref, watch } from 'vue';
|
||||
import { ButtonTab, ChromeTab } from '@soybeanjs/vue-admin-tab';
|
||||
import { useTabStore, useThemeStore } from '@/store';
|
||||
import { t } from '@/locales';
|
||||
import { ContextMenu } from './components';
|
||||
|
||||
defineOptions({ name: 'TabDetail' });
|
||||
|
@ -14,7 +14,7 @@ export function setupI18n(app: App) {
|
||||
}
|
||||
|
||||
export function t(key: string) {
|
||||
return i18n.global.t(key);
|
||||
return key.includes('message.') ? i18n.global.t(key) : key;
|
||||
}
|
||||
|
||||
export function setLocale(locale: LocaleKey) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { Router } from 'vue-router';
|
||||
import { useTitle } from '@vueuse/core';
|
||||
import { t } from '@/locales';
|
||||
import { createPermissionGuard } from './permission';
|
||||
|
||||
/**
|
||||
@ -15,7 +16,7 @@ export function createRouterGuard(router: Router) {
|
||||
});
|
||||
router.afterEach(to => {
|
||||
// 设置document title
|
||||
useTitle(to.meta.title);
|
||||
useTitle(t(to.meta.title));
|
||||
// 结束 loadingBar
|
||||
window.$loadingBar?.finish();
|
||||
});
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { useIconRender } from '@/composables';
|
||||
import { t } from '@/locales';
|
||||
|
||||
/** 路由不转换菜单 */
|
||||
function hideInMenu(route: AuthRoute.Route) {
|
||||
@ -48,7 +49,7 @@ export function transformAuthRouteToMenu(routes: AuthRoute.Route[]): GlobalMenuO
|
||||
const menuItem: GlobalMenuOption = addPartialProps({
|
||||
menu: {
|
||||
key: routeName,
|
||||
label: meta.title,
|
||||
label: t(meta.title),
|
||||
routeName,
|
||||
routePath: path
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user