import Vue from 'vue'
import VueI18n from 'vue-i18n'
import LangCN from './zh-cn'
import LangEn from './en-us'
import LangRu from './ru-ru'
import LangEs from './es-es'
import elementEnLocale from 'element-ui/lib/locale/lang/en'
import elementZhLocale from 'element-ui/lib/locale/lang/zh-CN'
import elementRuLocale from 'element-ui/lib/locale/lang/ru-RU'
import elementEsLocale from 'element-ui/lib/locale/lang/es'
import locale from 'element-ui/lib/locale'

Vue.use(VueI18n)
const i18n = new VueI18n({
    locale: localStorage.getItem("local"),
    messages: {
        'russia': {
            ...LangRu,
            ...elementRuLocale
        },
        'english': {
            ...LangEn,
            ...elementEnLocale
        },
        'chinese': {
            ...LangCN,
            ...elementZhLocale
        },
        'spanish': {
            ...LangEs,
            ...elementEsLocale
        }
    }
})

locale.i18n((key, value) => i18n.t(key, value))
export default i18n
