File tree Expand file tree Collapse file tree 1 file changed +38
-13
lines changed Expand file tree Collapse file tree 1 file changed +38
-13
lines changed Original file line number Diff line number Diff line change 21
21
22
22
the below example that` App.vue ` have ` i18n ` custom block:
23
23
24
- ### Custom Blocks (Single File Components)
25
- ``` vue
26
- <i18n>
27
- {
28
- "en": {
29
- "hello": "hello world!"
30
- },
31
- "ja": {
32
- "hello": "こんにちは、世界!"
33
- }
34
- }
35
- </i18n>
24
+ ### Basic
36
25
26
+ ``` vue
37
27
<template>
38
28
<p>{{ $t('hello') }}</p>
39
29
</template>
@@ -44,15 +34,29 @@ export default {
44
34
// ...
45
35
}
46
36
</script>
37
+
38
+ <i18n>
39
+ {
40
+ "en": {
41
+ "hello": "hello world!"
42
+ },
43
+ "ja": {
44
+ "hello": "こんにちは、世界!"
45
+ }
46
+ }
47
+ </i18n>
47
48
```
48
49
50
+ ### Source importing
51
+
49
52
you also can:
50
53
51
54
``` vue
52
55
<i18n src="./myLang.json"></i18n>
53
56
```
54
57
55
- ``` json
58
+ ``` json5
59
+ // ./myLnag.json
56
60
{
57
61
" en" : {
58
62
" hello" : " hello world!"
@@ -63,6 +67,27 @@ you also can:
63
67
}
64
68
```
65
69
70
+ ### Locale definition
71
+
72
+ You can define locale messages for each locale in single-file components:
73
+
74
+ ``` vue
75
+ <i18n locale="en">
76
+ {
77
+ "hello": "hello world!"
78
+ }
79
+ </i18n>
80
+
81
+ <i18n locale="ja">
82
+ {
83
+ "hello": "こんにちは、世界!"
84
+ }
85
+ </i18n>
86
+ ```
87
+
88
+ The above defines two locales, which are merged at target single-file components.
89
+
90
+
66
91
### JavaScript
67
92
68
93
``` javascript
You can’t perform that action at this time.
0 commit comments