Blame view

frontend/manage/src/locale/index.js 1.44 KB
8d73e917   陈威   初始化提交
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import elementEnLocale from 'element-ui/lib/locale/lang/en' // element-ui lang
import elementZhLocale from 'element-ui/lib/locale/lang/zh-CN' // element-ui lang
import elementZhTWLocale from 'element-ui/lib/locale/lang/zh-TW' // element-ui lang

import hotentEnLocale from 'hotent-ui/src/locale/lang/en' // hotent-ui lang
import hotentZhLocale from 'hotent-ui/src/locale/lang/zh-CN' // hotent-ui lang
import hotentZhTWLocale from 'hotent-ui/src/locale/lang/zh-TW' // hotent-ui lang

import hotentPortalEnLocale from 'hotent-portal/src/locale/lang/en' // hotent-portal en
import hotentPortalZhLocale from 'hotent-portal/src/locale/lang/zh-CN' // hotent-portal zh-CN
import hotentPortalZhTWLocale from 'hotent-portal/src/locale/lang/zh-TW' // hotent-portal zh-TW

import enLocale from './lang/en'
import zhLocale from './lang/zh-CN'
import zhTWLocale from './lang/zh-TW'

Vue.use(VueI18n)
const messages = {
  en: {
    ...enLocale,
    ...elementEnLocale,
    ...hotentEnLocale,
    ...hotentPortalEnLocale
  },
  'zh-CN': {
    ...zhLocale,
    ...elementZhLocale,
    ...hotentZhLocale,
    ...hotentPortalZhLocale,
  },
  'zh-TW': {
    ...zhTWLocale,
    ...elementZhTWLocale,
    ...hotentZhTWLocale,
    ...hotentPortalZhTWLocale
  }
}

const i18n = new VueI18n({
  // set locale
  // options: en | zh
  locale: localStorage.getItem('lang') || 'zh-CN',
  // set locale messages
  messages
})

export default i18n