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/advanced/composition.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Composition API
2
2
3
-
The introduction of `setup` and Vue’s [Composition API](https://v3.vuejs.org/guide/composition-api-introduction.html)open up new possibilities. But to be able to get the full potential out of Vue I18n, we will need to use a few new functions to replace access to `this`.
3
+
The introduction of `setup` and Vue’s [Composition API](https://v3.vuejs.org/guide/composition-api-introduction.html)opens up new possibilities. But to be able to get the full potential out of Vue I18n, we will need to use a few new functions to replace access to `this`.
4
4
5
5
We have been describing the features of Vue I18n using the Legacy API, which is compatible with vue-i18n v8.x. Now let’s take a look at Vue I18n `useI18n` for Composition API.
6
6
@@ -37,7 +37,7 @@ The following properties of i18n instance created by `createI18n` change its beh
37
37
-`global` property: VueI18n instance to Composer instance
38
38
:::
39
39
40
-
You are now ready to use `useI18n`. Now you are ready to use `useI18n` in the component `setup`. The code looks like this:
40
+
You are now ready to use `useI18n` in the component `setup`. The code looks like this:
41
41
42
42
```js{5-8}
43
43
// ...
@@ -57,7 +57,7 @@ You must call `useI18n` at top of the `setup`.
57
57
58
58
The `useI18n` returns a Composer instance. The Composer instance provides a translation API such as the `t` function, as well as properties such as `locale` and `fallbackLocale`, just like the VueI18n instance. For more information on the Composer instance, see the [API Reference](../../api/composition#composer).
59
59
60
-
In the above example, there are no options for `useI18n`, so it returns a Composer instance that works with the global scope. As such, it returns a Composer instance that works with the global scope, which means that the localized message referenced by the spread `t` function here is the one specified in `createI18n`. This means that the locale message referenced by the spread `t` function here will be the locale message specified in `createI18n`.
60
+
In the above example, there are no options for `useI18n`, so it returns a Composer instance that works with the global scope. As such, it returns a Composer instance that works with the global scope, which means that the localized message referenced by the spread `t` function here is the one specified in `createI18n`.
61
61
62
62
By returning `t` as render context in the `setup`, you can use `t` in the components template:
63
63
@@ -77,7 +77,7 @@ The output follows:
77
77
78
78
## Message Translation
79
79
80
-
In the Legacy API mode, The messages were translated using either `$t` or the VueI18n instance of `t` to translate the message.
80
+
In the Legacy API mode, the messages were translated using either `$t` or the VueI18n instance of `t`.
81
81
82
82
In the Composition API mode, the Message Format Syntax remains the same as in the Legacy API mode. You can use the Composer instance `t` to translate a message as follows:
0 commit comments