mirror of https://github.com/ElemeFE/element
Merge pull request #1578 from QingWei-Li/fix/i18n-doc
doc: IgnorePlugin => NormalModuleReplacementPlugin, fixed #1315pull/1581/head
commit
67a009b7a7
|
@ -26,13 +26,13 @@ Vue.component(Button.name, Button)
|
||||||
Vue.component(Select.name, Select)
|
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:
|
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
|
webpack.config.js
|
||||||
```javascript
|
```javascript
|
||||||
{
|
{
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.IgnorePlugin(/element-ui\/lib\/locale\/lang\/zh-CN/)
|
new webpack.NormalModuleReplacementPlugin(/element-ui[\/\\]lib[\/\\]locale[\/\\]lang[\/\\]zh-CN/, 'element-ui/lib/locale/lang/en')
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
|
@ -38,13 +38,13 @@ Vue.component(Button.name, Button)
|
||||||
Vue.component(Select.name, Select)
|
Vue.component(Select.name, Select)
|
||||||
```
|
```
|
||||||
|
|
||||||
如果使用其它语言,默认情况下中文语言包依旧是被引入的,可以使用 webpack 的 IgnorePlugin 忽略掉它以减少打包后的文件体积。
|
如果使用其它语言,默认情况下中文语言包依旧是被引入的,可以使用 webpack 的 NormalModuleReplacementPlugin 替换默认语言包。
|
||||||
|
|
||||||
**webpack.config.js**
|
**webpack.config.js**
|
||||||
```javascript
|
```javascript
|
||||||
{
|
{
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.IgnorePlugin(/element-ui\/lib\/locale\/lang\/zh-CN/)
|
new webpack.NormalModuleReplacementPlugin(/element-ui[\/\\]lib[\/\\]locale[\/\\]lang[\/\\]zh-CN/, 'element-ui/lib/locale/lang/en')
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -69,5 +69,5 @@ Vue.component(Select.name, Select)
|
||||||
<li>土耳其语(tr-TR)</li>
|
<li>土耳其语(tr-TR)</li>
|
||||||
<li>巴西葡萄牙语(pt-br)</li>
|
<li>巴西葡萄牙语(pt-br)</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
如果你需要使用其他的语言,欢迎贡献 PR:只需在 [这里](https://github.com/ElemeFE/element/tree/master/src/locale/lang) 添加一个语言配置文件即可。
|
如果你需要使用其他的语言,欢迎贡献 PR:只需在 [这里](https://github.com/ElemeFE/element/tree/master/src/locale/lang) 添加一个语言配置文件即可。
|
||||||
|
|
Loading…
Reference in New Issue