index.js 938 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { createI18n } from 'vue-i18n'
  2. import VueI18n from 'vue-i18n'
  3. import {
  4. post,
  5. get
  6. } from '@/utils/axios'
  7. const i18n = createI18n({
  8. legacy: false, // 让 setup 函数可以通过 t 访问
  9. globalInjection: true, // 让 template 可以像 vue2 那样使用 $t 来访问
  10. locale: 'zh-cn',
  11. fallbackLocale: 'zh-cn',
  12. messages: {
  13. 'zh-cn': require('./cn.js').lang,
  14. 'en-us': require('./en.js').lang,
  15. }
  16. })
  17. // const networkLang = {
  18. // web:{},
  19. // app:{
  20. // cn:require('./cn.js').lang,
  21. // en:require('./en.js').lang,
  22. // },
  23. // }
  24. // post('/open/multilingual/setJson', {
  25. // configValue: JSON.stringify(networkLang),
  26. // })
  27. //console.log(require('./en.js').lang)
  28. //get('/open/multilingual/getJson',{}).then(res=>{
  29. // console.log(JSON.parse(res.data),'下载')
  30. // window.localStorage.setItem('lang',res.data)
  31. // i18n.global.setLocaleMessage('zh-cn', require('./cn.js').lang)
  32. //})
  33. export default i18n