You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vue.use(VueI18n, { bridge:true }) // you must specify '{ bridge: true }' plugin option when install vue-i18n
73
+
74
+
// `createI18n` options is almost same vue-i18n-next ([email protected]) API
75
+
consti18n=createI18n({
76
+
legacy:false,
77
+
locale:'ja',
78
+
messages: {
79
+
en: {
80
+
message: {
81
+
hello:'hello, {name}!'
82
+
}
83
+
},
84
+
ja: {
85
+
message: {
86
+
hello:'こんにちは、{name}!'
87
+
}
88
+
}
89
+
}
90
+
}, VueI18n) // `createI18n` which is provide `vue-i18n-bridge` has second argument, you **must** pass `VueI18n` constructor which is provide `vue-i18n`
91
+
92
+
constapp=createApp({
93
+
setup() {
94
+
// `useI18n` options is almost same vue-i18n-next ([email protected]) API
95
+
const { t, locale } =useI18n()
96
+
// ... todo something
97
+
98
+
return { t, locale }
99
+
}
100
+
})
101
+
102
+
app.use(i18n) // you must install `i18n` instance which is created by `createI18n`
Vue.use(VueI18n, { bridge:true }) // you must specify '{ bridge: true }' plugin option when install vue-i18n
157
+
158
+
// `createI18n` options is almost same vue-i18n-next ([email protected]) API
159
+
consti18n=createI18n({
160
+
locale:'ja',
161
+
messages: {
162
+
en: {
163
+
message: {
164
+
hello:'hello, {name}!'
165
+
}
166
+
},
167
+
ja: {
168
+
message: {
169
+
hello:'こんにちは、{name}!'
170
+
}
171
+
}
172
+
}
173
+
}, VueI18n) // `createI18n` which is provide `vue-i18n-bridge` has second argument, you **must** pass `VueI18n` constructor which is provide `vue-i18n`
174
+
175
+
Vue.use(i18n) // you must install `i18n` instance which is created by `createI18n`
176
+
177
+
constapp=newVue({ i18n })
178
+
app.$mount('#app')
179
+
```
180
+
181
+
**For Vue 2.6**:
182
+
91
183
```js
92
184
importVuefrom'vue'
93
185
importVueCompositionAPIfrom'@vue/composition-api'
@@ -119,7 +211,8 @@ const app = new Vue({ i18n })
119
211
app.$mount('#app')
120
212
```
121
213
122
-
for TypeScript:
214
+
**For TypeScript:**
215
+
123
216
```ts
124
217
importVuefrom'vue'
125
218
importVueCompositionAPIfrom'@vue/composition-api'
@@ -153,8 +246,17 @@ app.$mount('#app')
153
246
154
247
### Usage UMD module in browser
155
248
249
+
#### For Vue 2.7
250
+
```js
251
+
const { createApp } = VueDemi // exported UMD which is named by `VueDemi`
252
+
const { createI18n, useI18n } = VueI18nBridge // exported UMD which is named by `VueI18nBridge`
253
+
254
+
Vue.use(VueI18n, { bridge:true })
255
+
```
256
+
257
+
#### For Vue 2.6
156
258
```js
157
-
const { createApp } = VueCompositionAPI // exported UMD which is named by `VueCompositionAPI
259
+
const { createApp } = VueCompositionAPI // exported UMD which is named by `VueCompositionAPI`
158
260
const { createI18n, useI18n } = VueI18nBridge // exported UMD which is named by `VueI18nBridge`
0 commit comments