|
|
|
@ -8,6 +8,7 @@ import moment from 'moment'; |
|
|
|
import { i18n } from './setupI18n'; |
|
|
|
import { useLocaleStoreWithOut } from '/@/store/modules/locale'; |
|
|
|
import { unref, computed } from 'vue'; |
|
|
|
import { loadLocalePool, setHtmlPageLang } from './helper'; |
|
|
|
|
|
|
|
interface LangModule { |
|
|
|
message: Recordable; |
|
|
|
@ -15,16 +16,6 @@ interface LangModule { |
|
|
|
momentLocaleName: string; |
|
|
|
} |
|
|
|
|
|
|
|
const loadLocalePool: LocaleType[] = []; |
|
|
|
|
|
|
|
export function setHtmlPageLang(locale: LocaleType) { |
|
|
|
document.querySelector('html')?.setAttribute('lang', locale); |
|
|
|
} |
|
|
|
|
|
|
|
export function setLoadLocalePool(cb: (loadLocalePool: LocaleType[]) => void) { |
|
|
|
cb(loadLocalePool); |
|
|
|
} |
|
|
|
|
|
|
|
function setI18nLanguage(locale: LocaleType) { |
|
|
|
const localeStore = useLocaleStoreWithOut(); |
|
|
|
|
|
|
|
@ -34,7 +25,7 @@ function setI18nLanguage(locale: LocaleType) { |
|
|
|
(i18n.global.locale as any).value = locale; |
|
|
|
} |
|
|
|
localeStore.setLocaleInfo({ locale }); |
|
|
|
setHtmlPageLang(locale) |
|
|
|
setHtmlPageLang(locale); |
|
|
|
} |
|
|
|
|
|
|
|
export function useLocale() { |
|
|
|
|