lang.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. // import en_us from '../lang/en_us.json'
  2. import zh_cn from '../lang/zh_cn.json'
  3. // import fr_fr from '../lang/fr_fr.json'
  4. // import th_th from '../lang/th_th.json'
  5. // import ja_jp from '../lang/ja_jp.json'
  6. // import it_it from '../lang/it_it.json'
  7. // import ko_kr from '../lang/ko_kr.json'
  8. // import mn_mn from '../lang/mn_mn.json'
  9. // import vi_vn from '../lang/vi_vn.json'
  10. // import zh_ft from '../lang/zh_ft.json'
  11. import Vue from 'vue';
  12. import VueI18n from 'vue-i18n'
  13. Vue.use(VueI18n)
  14. let langJson = {
  15. 'zh_cn': zh_cn,
  16. }
  17. let lang = '';
  18. // #ifdef MP || APP-PLUS
  19. lang = uni.getStorageSync('locale') != '' ? uni.getStorageSync('locale') : 'zh_cn';
  20. // #endif
  21. // #ifdef H5
  22. lang = uni.getStorageSync('locale') != '' ? uni.getStorageSync('locale') : navigator.language.toLowerCase().replace('-','_');
  23. // #endif
  24. const i18n = new VueI18n({
  25. locale: lang in langJson ? lang :'zh_cn',
  26. messages: langJson
  27. })
  28. //import i18n from './lang.js';
  29. // const i18n = {
  30. // t:function(key){
  31. // return key
  32. // }
  33. // }
  34. export default i18n