File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 11import type { ElegantConstRoute } from '@elegant-router/types' ;
22
3- import { $t } from '@/locales' ;
4-
53/**
64 * Get global menus by auth routes
75 *
@@ -30,11 +28,15 @@ export function getGlobalMenusByAuthRoutes(routes: ElegantConstRoute[]) {
3028 *
3129 * @param route
3230 */
31+
3332export function getGlobalMenuByBaseRoute ( route : ElegantConstRoute ) : App . Global . Menu {
3433 const { name } = route ;
3534 const { title, i18nKey, icon = import . meta. env . VITE_MENU_ICON , localIcon } = route . meta ?? { } ;
3635
37- const label = i18nKey ? $t ( i18nKey ) : title ;
36+ // eslint-disable-next-line
37+ const { t } = useTranslation ( )
38+ // eslint-disable-next-line
39+ const label = i18nKey ? t ( i18nKey ) : title ;
3840 const menu : App . Global . Menu = {
3941 key : name ,
4042 label : < BeyondHiding title = { label } /> ,
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import i18n from 'i18next';
22import { initReactI18next } from 'react-i18next' ;
33import { localStg } from '@/utils/storage' ;
44import locales from './locale' ;
5+
56/** Setup plugin i18n */
67export function setupI18n ( ) {
78 i18n . use ( initReactI18next ) . init ( {
@@ -12,7 +13,9 @@ export function setupI18n() {
1213 }
1314 } ) ;
1415}
16+
1517export const $t = i18n . t ;
18+
1619export function setLng ( locale : App . I18n . LangType ) {
1720 i18n . changeLanguage ( locale ) ;
1821}
You can’t perform that action at this time.
0 commit comments