index.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // import Cookies from 'js-cookie'
  2. // import VueI18n from 'vue-i18n'
  3. // import Vue from 'vue'
  4. // Vue.use(VueI18n)
  5. // export default ({ app, store }) => {
  6. // // const data = {}
  7. // // // console.log(this.$store.index.locale,'22');
  8. // // const locale = Cookies.get('hb_lang') || language.lang
  9. // // const readDir = ['zh_CN', 'en_US']
  10. // // for (let i = 0; i < readDir.length; i++) {
  11. // // data[readDir[i]] = Object.assign({}, require(`./${readDir[i]}.json`))
  12. // // }
  13. // // // Set i18n instance on app
  14. // // // This way we can use it in middleware and pages asyncData/fetch
  15. // // app.i18n = new VueI18n({
  16. // // locale,
  17. // // fallbackLocale: locale, // 语言环境中不存在相应massage键时回退到指定语言
  18. // // messages: data
  19. // // })
  20. // // console.log(Cookies.get('hb_lang'),'221');
  21. // app.i18n = new VueI18n({
  22. // locale: store.state.locale,
  23. // fallbackLocale: 'zh_CN',
  24. // messages: {
  25. // 'en_US': require('@/locales/en_US.json'),
  26. // 'zh_CN': require('@/locales/zh_CN.json')
  27. // }
  28. // })
  29. // app.i18n.path = (link) => {
  30. // // 如果是默认语言,就省略
  31. // if (app.i18n.locale === app.i18n.fallbackLocale) {
  32. // return `/${link}`
  33. // }
  34. // return `/${app.i18n.locale}/${link}`
  35. // }
  36. // }
  37. export default () => {
  38. return [
  39. 'en',
  40. 'zh'
  41. ]
  42. }