import { createI18n } from 'vue-i18n';
import ZH from './zh.js';
import EN from './en.js';
import JA from './ja.js';
import KR from './kr.js';
const messages = {
  zh: { ...ZH  },
  en: { ...EN  },
  ja: { ...JA  },
  kr: { ...KR  },
};
let current = (localStorage && localStorage.getItem('language'))
console.log('current', current )
if (!current) {
  current = window.navigator.language || window.navigator.userLanguage || null
    if (current && !/^zh/.test(current)) {
        console.log('自动获取浏览器语言:' + current)
        current = 'en'
    }else{
      current = 'zh'
    }
}
document.title = current !== 'zh' ? '4DAGE' : '四维时代'

const i18n = createI18n({
  legacy: false,
  globalInjection: true,
  locale: current,
  messages
});
export default i18n;
