Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
78bea125
Commit
78bea125
authored
May 02, 2017
by
qingwei.li
Committed by
杨奕
May 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Docs(i18n): add on-demand
parent
99f9d995
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
0 deletions
+66
-0
examples/docs/en-US/i18n.md
examples/docs/en-US/i18n.md
+33
-0
examples/docs/zh-CN/i18n.md
examples/docs/zh-CN/i18n.md
+33
-0
No files found.
examples/docs/en-US/i18n.md
View file @
78bea125
...
...
@@ -108,6 +108,39 @@ Vue.use(Element, {
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-ui/lib/locale/lang/en
'
import
zhLocale
from
'
element-ui/lib/locale/lang/zh-CN
'
import
ElementLocale
from
'
element-ui/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
=>
i18n
.
t
(
key
))
```
## Import via CDN
```
html
...
...
examples/docs/zh-CN/i18n.md
View file @
78bea125
...
...
@@ -120,6 +120,39 @@ Vue.use(Element, {
new
Vue
({
i18n
}).
$mount
(
'
#app
'
)
```
## 按需加载里定制 i18n
```
js
import
Vue
from
'
vue
'
import
DatePicker
from
'
element/lib/date-picker
'
import
VueI18n
from
'
vue-i18n
'
import
enLocale
from
'
element-ui/lib/locale/lang/en
'
import
zhLocale
from
'
element-ui/lib/locale/lang/zh-CN
'
import
ElementLocale
from
'
element-ui/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
=>
i18n
.
t
(
key
))
```
## 通过 CDN 的方式加载语言文件
```
html
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment