Files
MrleeAdmin/frontend/web/app/composables/lang.ts
T

10 lines
295 B
TypeScript
Raw Normal View History

2026-01-16 22:04:12 +08:00
import { useRoute } from 'vue-router'
export function t(message: string) {
2026-04-07 11:01:11 +08:00
const nuxtApp: any = useNuxtApp()
const i18nInstance = nuxtApp.$getI18n()
// 直接使用 i18n 的 t 方法,让它自动根据 locale 选择对应的翻译
return i18nInstance.global.t(message)
2026-01-16 22:04:12 +08:00
}