i18n.ts 348 字节
Newer Older
1 2 3 4
import { BuiltInLocale } from '@dcloudio/uni-i18n'
import { useI18n } from '../../i18n'

export function initI18n() {
fxy060608's avatar
fxy060608 已提交
5
  const localeKeys = Object.keys(__uniConfig.locales || {})
6 7 8 9 10 11 12
  if (localeKeys.length) {
    const i18n = useI18n()
    localeKeys.forEach((locale) =>
      i18n.add(locale as BuiltInLocale, __uniConfig.locales[locale])
    )
  }
}