## Internationalization The default language of Element Plus 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 Plus entirely: ```javascript import { createApp } from 'vue' import ElementPlus from 'element-plus' import locale from 'element-plus/lib/locale/lang/en' createApp(App).use(ElementPlus, { locale }) ``` Or if you are importing Element Plus on demand: ```javascript import Vue from 'vue' import { Button, Select } from 'element-plus' import lang from 'element-plus/lib/locale/lang/en' import locale from 'element-plus/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 `NormalModuleReplacementPlugin` provided by webpack you can replace default locale: webpack.config.js ```javascript { plugins: [ new webpack.NormalModuleReplacementPlugin(/element-plus[\/\\]lib[\/\\]locale[\/\\]lang[\/\\]zh-CN/, 'element-plus/lib/locale/lang/en') ] } ``` ## Compatible with `vue-i18n@5.x` Element Plus is compatible with [vue-i18n@5.x](https://github.com/kazupon/vue-i18n), which makes multilingual switching even easier. ```javascript import Vue from 'vue' import VueI18n from 'vue-i18n' import ElementPlus from 'element-plus' import enLocale from 'element-plus/lib/locale/lang/en' import zhLocale from 'element-plus/lib/locale/lang/zh-CN' import App from './App.vue'; const app = createApp(App) app.use(ElementPlus) Vue.use(VueI18n) Vue.config.lang = 'zh-cn' Vue.locale('zh-cn', zhLocale) Vue.locale('en', enLocale) ``` ## Compatible with other i18n plugins Element Plus may not be compatible with i18n plugins other than vue-i18n, but you can customize how Element Plus processes i18n. ```javascript import Vue from 'vue' import ElementPlus from 'element-plus' import enLocale from 'element-plus/lib/locale/lang/en' import zhLocale from 'element-plus/lib/locale/lang/zh-CN' Vue.use(Element, { i18n: function (path, options) { // ... } }) ``` ## Compatible with `vue-i18n@6.x` You need to manually handle it for compatibility with `6.x`. ```javascript import Vue from 'vue' import ElementPlus from 'element-plus' import VueI18n from 'vue-i18n' import enLocale from 'element-plus/lib/locale/lang/en' import zhLocale from 'element-plus/lib/locale/lang/zh-CN' Vue.use(VueI18n) const messages = { en: { message: 'hello', ...enLocale // Or use `Object.assign({ message: 'hello' }, enLocale)` }, zh: { message: '你好', ...zhLocale // Or use `Object.assign({ message: '你好' }, zhLocale)` } } // Create VueI18n instance with options const i18n = new VueI18n({ locale: 'en', // set locale messages, // set locale messages }) Vue.use(Element, { i18n: (key, value) => i18n.t(key, value) }) new Vue({ i18n }).$mount('#app') ``` ## Custom i18n in on-demand components ```js import Vue from 'vue' import DatePicker from 'element/lib/date-picker' import VueI18n from 'vue-i18n' import enLocale from 'element-plus/lib/locale/lang/en' import zhLocale from 'element-plus/lib/locale/lang/zh-CN' import ElementLocale from 'element-plus/lib/locale' Vue.use(VueI18n) Vue.use(DatePicker) const messages = { en: { message: 'hello', ...enLocale }, zh: { message: '你好', ...zhLocale } } // Create VueI18n instance with options const i18n = new VueI18n({ locale: 'en', // set locale messages, // set locale messages }) ElementLocale.i18n((key, value) => i18n.t(key, value)) ``` ## Import via CDN ```html ``` Compatible with `vue-i18n` ```html ``` Currently Element Plus ships with the following languages: