import { createI18n } from 'vue-i18n'
import zh from '@/locale/zh'
import bo from '@/locale/bo'
import { getStoredLocale } from '@/utils/locale'

export function setupI18n(app) {
  const locale = getStoredLocale()
  const i18n = createI18n({
    legacy: true,
    globalInjection: true,
    locale,
    fallbackLocale: 'zh',
    messages: {
      zh,
      bo
    }
  })
  app.use(i18n)
  return i18n
}
