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
Copy file name to clipboardExpand all lines: docs/guide/migration/ways.md
+81Lines changed: 81 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -230,3 +230,84 @@ About how to usage, See the [here](https://github.com/intlify/vue-i18n-composabl
230
230
:::warning NOTICE
231
231
`vue-i18n-composable` allows the main API of Vue I18n v8.x to work with the Composition API. All of Composition API provided in Vue I18n v9 are not available.
232
232
:::
233
+
234
+
## Migration to Composition API from Legacy API
235
+
236
+
### Summary
237
+
238
+
Vue I18n supports both styles which are Legacy API mode and Composiyion API mode. Legacy API mode is Options API style, and Composition API mode support Vue Composition API that is able to compose with function.
239
+
240
+
Legacy API mode is almost compatible with legacy Vue I18n v8.x, making it relatively easy to migrate Vue applications to Vue 3. Vue 3 supports the Options API style, so existing Vue 2 applications will be cases where applications will be migrated to Vue 3.
241
+
242
+
Vue 3 allows you to make Vue applications using a mix of the Options API style and Composition API style, but Vue I18n has not allowed for a mix of these API styles since the v9 initial release, so you can use either one or the other API style only.
243
+
244
+
Developing a Vue application with a mix of Options API styles and Compostion API styles is not a desirable software development project from a maintenance standpoint. This is because the cost of maintaining such code is high. However, there are advantages to using both styles. In particular, API style migration is easier to migrate step-by-step, since it works even when implemented in both API styles.
245
+
246
+
From Vue I18n v9.2, the Legacy API mode can also be used with Composition API mode.
247
+
248
+
### Limitations
249
+
250
+
**The Composition API in Legacy API mode does not support SSR**, So You should understand as a limited feature for migration.
251
+
252
+
### How to migration
253
+
254
+
#### `createI18n`
255
+
256
+
You need specify `allowComposition: true` to `createI18n` otpions. the below example:
257
+
258
+
```js
259
+
import { createI18n } from'vue-i18n'
260
+
261
+
consti18n=createI18n({
262
+
locale:'en',
263
+
allowCompositoin:true, // you need to specify that!
264
+
messages: {
265
+
en: {
266
+
hello:'hello!'
267
+
},
268
+
ja: {
269
+
hello:'こんにちは!'
270
+
}
271
+
}
272
+
})
273
+
274
+
console.log(i18n.allowComposition) // output is true
Copy file name to clipboardExpand all lines: docs/ja/guide/migration/ways.md
+81Lines changed: 81 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -199,3 +199,84 @@ About how to usage, See the [here](https://github.com/intlify/vue-i18n-composabl
199
199
:::warning NOTICE
200
200
`vue-i18n-composable` allows the main API of Vue I18n v8.x to work with the Composition API. All of Composition API provided in Vue I18n v9 are not available.
201
201
:::
202
+
203
+
## Migration to Composition API from Legacy API
204
+
205
+
### Summary
206
+
207
+
Vue I18n supports both styles which are Legacy API mode and Composiyion API mode. Legacy API mode is Options API style, and Composition API mode support Vue Composition API that is able to compose with function.
208
+
209
+
Legacy API mode is almost compatible with legacy Vue I18n v8.x, making it relatively easy to migrate Vue applications to Vue 3. Vue 3 supports the Options API style, so existing Vue 2 applications will be cases where applications will be migrated to Vue 3.
210
+
211
+
Vue 3 allows you to make Vue applications using a mix of the Options API style and Composition API style, but Vue I18n has not allowed for a mix of these API styles since the v9 initial release, so you can use either one or the other API style only.
212
+
213
+
Developing a Vue application with a mix of Options API styles and Compostion API styles is not a desirable software development project from a maintenance standpoint. This is because the cost of maintaining such code is high. However, there are advantages to using both styles. In particular, API style migration is easier to migrate step-by-step, since it works even when implemented in both API styles.
214
+
215
+
From Vue I18n v9.2, the Legacy API mode can also be used with Composition API mode.
216
+
217
+
### Limitations
218
+
219
+
**The Composition API in Legacy API mode does not support SSR**, So You should understand as a limited feature for migration.
220
+
221
+
### How to migration
222
+
223
+
#### `createI18n`
224
+
225
+
You need specify `allowComposition: true` to `createI18n` otpions. the below example:
226
+
227
+
```js
228
+
import { createI18n } from'vue-i18n'
229
+
230
+
consti18n=createI18n({
231
+
locale:'en',
232
+
allowCompositoin:true, // you need to specify that!
233
+
messages: {
234
+
en: {
235
+
hello:'hello!'
236
+
},
237
+
ja: {
238
+
hello:'こんにちは!'
239
+
}
240
+
}
241
+
})
242
+
243
+
console.log(i18n.allowComposition) // output is true
0 commit comments