mirror of https://github.com/ElemeFE/element
Docs: add i18n.md (#740)
parent
8d37478a4b
commit
ef5dd18f32
21
README.md
21
README.md
|
@ -13,6 +13,16 @@
|
|||
- [Home Page](http://element.eleme.io/)
|
||||
- [Docs](http://element.eleme.io/#/component)
|
||||
- [FAQ 中文](./FAQ.md)
|
||||
- [i18n](./i18n.md)
|
||||
- Starter Kit
|
||||
- [element-starter](https://github.com/ElementUI/element-starter)
|
||||
- [element-cooking-starter](https://github.com/ElementUI/element-cooking-starter)
|
||||
- [element-in-laravel-starter](https://github.com/ElementUI/element-in-laravel-starter)
|
||||
- [Design resources](https://github.com/ElementUI/Resources)
|
||||
- Boilerplate for bug reports
|
||||
- [CodePen](https://codepen.io/anon/pen/ozYpNA)
|
||||
- [JSFiddle](https://jsfiddle.net/gmve9d3p/)
|
||||
- [Mint UI](https://github.com/ElemeFE/mint-ui) - Mobile UI elements for Vue.js
|
||||
|
||||
## Install
|
||||
```shell
|
||||
|
@ -79,17 +89,6 @@ Skip this part if you just want to use Element.
|
|||
|
||||
For those who are interested in contributing to Element, please refer to our [contributing guide](https://github.com/ElemeFE/element/blob/master/.github/CONTRIBUTING.md) to see how to run this project.
|
||||
|
||||
## Other links
|
||||
- Starter Kit
|
||||
- [element-starter](https://github.com/ElementUI/element-starter)
|
||||
- [element-cooking-starter](https://github.com/ElementUI/element-cooking-starter)
|
||||
- [element-in-laravel-starter](https://github.com/ElementUI/element-in-laravel-starter)
|
||||
- [Design resources](https://github.com/ElementUI/Resources)
|
||||
- Boilerplate for bug reports
|
||||
- [CodePen](https://codepen.io/anon/pen/ozYpNA)
|
||||
- [JSFiddle](https://jsfiddle.net/gmve9d3p/)
|
||||
- [Mint UI](https://github.com/ElemeFE/mint-ui) - Mobile UI elements for Vue.js
|
||||
|
||||
## Changelog
|
||||
Detailed changes for each release are documented in the [release notes](https://github.com/ElemeFE/element/releases).
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ Vue.component(Button.name, Button)
|
|||
Vue.component(Select.name, Select)
|
||||
```
|
||||
|
||||
如果使用其它语言,默认情况下中文语言包依旧是被引入的,可以使用 webpack 的 IgnorePlugn 忽略掉它以减少打包后的文件体积。
|
||||
如果使用其它语言,默认情况下中文语言包依旧是被引入的,可以使用 webpack 的 IgnorePlugin 忽略掉它以减少打包后的文件体积。
|
||||
|
||||
webpack.config.js
|
||||
```javascript
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
## 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:
|
||||
|
||||
```javascript
|
||||
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:
|
||||
|
||||
```javascript
|
||||
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
|
||||
```javascript
|
||||
{
|
||||
plugins: [
|
||||
new webpack.IgnorePlugin(/element-ui\/lib\/locale\/lang\/zh-cn/)
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Currently Element ships with the following languages:
|
||||
- Chinese
|
||||
- English
|
||||
- German
|
||||
|
||||
If your target language is not included, you are more than welcome to contribute: just add another language config [here](https://github.com/ElemeFE/element/tree/master/src/locale/lang) and create a pull request.
|
Loading…
Reference in New Issue