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