element-plus/docs/en-US/guide/i18n.md
2022-01-24 23:37:19 +08:00

3.1 KiB

title lang
Internationalization en-US

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/lib/locale/lang/zh-cn'

  export default defineComponent({
    components: {
      ElConfigProvider,
    },
    setup() {
      return {
        locale: zhCn,
      }
    },
  })
</script>

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

Supported Language List

  • Simplified Chinese (zh-cn)
  • American English (en)
  • 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)
  • 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.