Internationalization
Element Plus components are using English by default, if you wish you use other languages, you can get you answer by keep reading.
Global configuration
Element Plus provides global configurations
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
app.use(ElementPlus, {
locale: zhCn,
})
ConfigProvider
Element Plus also provides a Vue component ConfigProvider for globally configuring locale and other settings.
<template>
<el-config-provider :locale="locale">
<app />
</el-config-provider>
</template>
<script>
import { defineComponent } from 'vue'
import { ElConfigProvider } from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
export default defineComponent({
components: {
ElConfigProvider,
},
setup() {
return {
locale: zhCn,
}
},
})
</script>
Date and time localization
We use Day.js library to manage date and time in components like DatePicker
. It is important to set a proper locale in Day.js to make the internationalization fully works. You have to import Day.js's locale config separately.
import 'dayjs/locale/zh-cn'
CDN Usage
If you are using Element Plus via CDN, then you need to do this, let's again take unpkg as an example
<script src="//unpkg.com/element-plus/dist/locale/zh-cn"></script>
<script>
app.use(ElementPlus, {
locale: ElementPlusLocaleZhCn,
})
</script>
Full documentation refer to: ConfigProvider
- Simplified Chinese (zh-cn)
- American English (en)
- Azerbaijani (az)
- German (de)
- Portuguese (pt)
- Spanish (es)
- Danish (da)
- French (fr)
- Norwegian (nb-NO)
- Traditional Chinese (zh-tw)
- Italian (it)
- Korean (ko)
- Japanese (ja)
- Dutch (nl)
- Vietnamese (vi)
- Russian (ru)
- Turkish (tr)
- Brazilian Portuguese (pt-br)
- Farsi (fa)
- Thai (th)
- Indonesian (id)
- Bulgarian (bg)
- Pashto (pa)
- Polish (pl)
- Finnish (fi)
- Swedish (sv)
- Greek (el)
- Slovak (sk)
- Catalunya (ca)
- Czech (cs)
- Ukrainian (uk)
- Turkmen (tk)
- Tamil (ta)
- Latvian (lv)
- Afrikaans (af)
- Estonian (et)
- Slovenian (sl)
- Arabic (ar)
- Hebrew (he)
- Lithuanian (lt)
- Mongolian (mn)
- Kazakh (kk)
- Hungarian (hu)
- Romanian (ro)
- Kurdish (ku)
- Kurdish (ckb)
- Uighur (ug-cn)
- Khmer (km)
- Serbian (sr)
- Basque (eu)
- Kyrgyz (ky)
- Armenian (hy-am)
- Croatian (hr)
- Esperanto (eo)
- Bengali (bn)
If you need any other languages, PR is always welcomed, you only need to add a language file at here.