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
| options | <code>I18nOptions</code> |see the [I18nOptions](./vue-i18n.i18noptions.md)|
22
20
23
21
<b>Returns:</b>
24
22
25
-
`VueI18n`
23
+
`Composer | VueI18n`
24
+
25
+
[Composer](./vue-i18n.composer.md) object, or [VueI18n](./vue-i18n.vuei18n.md) object
26
+
27
+
## Remarks
28
+
29
+
When you use Composable API, you need to specify options of [ComposerOptions](./vue-i18n.composeroptions.md)<!---->. When you use Legacy API, you need toto specify options of [VueI18nOptions](./vue-i18n.vuei18noptions.md) and `legacy: true`<!---->.
30
+
31
+
## Example 1
32
+
33
+
case: for Composable API
34
+
35
+
```js
36
+
import { createApp } from'vue'
37
+
import { createI18n, useI18n } from'vue-i18n'
38
+
39
+
// call with I18n option
40
+
consti18n=createI18n({
41
+
locale:'ja',
42
+
messages: {
43
+
en: { ... },
44
+
ja: { ... }
45
+
}
46
+
})
47
+
48
+
constApp= {
49
+
setup() {
50
+
// ...
51
+
const { t } =useI18n({ ... })
52
+
return { ... , t }
53
+
}
54
+
}
55
+
56
+
constapp=createApp(App)
57
+
58
+
// install!
59
+
app.use(i18n)
60
+
app.mount('#app')
61
+
62
+
```
63
+
64
+
## Example 2
65
+
66
+
case: for Legacy API
67
+
68
+
```js
69
+
import { createApp } from'vue'
70
+
import { createI18n } from'vue-i18n'
71
+
72
+
// call with I18n option
73
+
consti18n=createI18n({
74
+
legacy:true, // you must specify 'lagacy: true' option
`I18nOptions` is union type of [ComposerOptions](./vue-i18n.composeroptions.md) and [VueI18nOptions](./vue-i18n.vuei18noptions.md)<!---->, so you can specify these options.
0 commit comments