import Cookies from 'js-cookie'
import { createI18n } from 'vue-i18n'

import zhCN from './zh-CN'
import en from './en'

/* 国际化初始化 */
const locale = Cookies.get('lang') || navigator.language || navigator.userLanguage || 'zh-CN'

const i18n = createI18n({
  locale,
  legacy: false,
  fallbackLocale: 'zh-CN',
  messages: { 'zh-CN': zhCN, en: en }
})

export default i18n
