Ben Lin
2024-06-18 ebbd788fbb2c0b45d4473798efc57eec8ba74a25
src/locales/useLocale.ts
@@ -1,12 +1,13 @@
/**
 * Multi-language related operations
 */
import type { LocaleType } from '/#/config';
import type { LocaleType } from '#/config';
import { i18n } from './setupI18n';
import { useLocaleStoreWithOut } from '/@/store/modules/locale';
import { useLocaleStoreWithOut } from '@/store/modules/locale';
import { unref, computed } from 'vue';
import { loadLocalePool, setHtmlPageLang } from './helper';
import { Locale } from 'ant-design-vue/es/locale';
interface LangModule {
  message: Recordable;
@@ -32,7 +33,8 @@
  const getShowLocalePicker = computed(() => localeStore.getShowPicker);
  const getAntdLocale = computed((): any => {
    return i18n.global.getLocaleMessage(unref(getLocale))?.antdLocale ?? {};
    const localeMessage = i18n.global.getLocaleMessage<{ antdLocale: Locale }>(unref(getLocale));
    return localeMessage?.antdLocale ?? {};
  });
  // Switching the language will change the locale of useI18n