Skip to content

Latest commit

 

History

History
46 lines (35 loc) · 1.3 KB

i18n.md

File metadata and controls

46 lines (35 loc) · 1.3 KB

Internationalization

The default language of Element is Chinese. If you wish to use another language, you'll need to do some i18n configuration. In your entry file, if you are importing Element entirely:

import Vue from 'vue'
import ElementUI from 'element-ui'
import locale from 'element-ui/lib/locale/lang/en'

Vue.use(ElementUI, { locale })

Or if you are importing Element on demand:

import Vue from 'vue'
import { Button, Select } from 'element-ui'
import lang from 'element-ui/lib/locale/lang/en'
import locale from 'element-ui/lib/locale'

// configure language
locale.use(lang)

// import components
Vue.component(Button.name, Button)
Vue.component(Select.name, Select)

The Chinese language pack is imported by default, even if you're using another language. But with IgnorePlugin provided by webpack you can ignore it when building:

webpack.config.js

{
  plugins: [
    new webpack.IgnorePlugin(/element-ui\/lib\/locale\/lang\/zh-CN/)
  ]
}

Currently Element ships with the following languages:

  • Chinese
  • English
  • German
  • Portuguese

If your target language is not included, you are more than welcome to contribute: just add another language config here and create a pull request.