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/essentials/pluralization.md
+23-24Lines changed: 23 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,34 +25,33 @@ The `car` has `car | cars` pluralization message, while the `apple` has `no appl
25
25
26
26
These plural messages are selected by the logic of the choice rule for each language in the translaton API according to the numeric value you specify at the translation API.
27
27
28
-
Vue I18n offers some ways to support pluralization. Here we’ll use the `$tc`.
28
+
Vue I18n offers some ways to support pluralization. Here we’ll use the `$t`.
29
29
30
30
:::tip NOTE
31
-
`$tc` has some overloads. About these overloads, see the [API Reference](../../api/injection#tc-key)
31
+
`$t` has some overloads. About these overloads, see the [API Reference](../../api/injection#t-key)
32
32
:::
33
33
34
34
:::tip NOTE
35
35
Some ways to support pluralization are:
36
36
37
-
-`$tc` (for Legacy API mode)
37
+
-injected gloal `$t`
38
38
-`v-t` custom directive
39
39
- built-in Translation component (`i18n-t`)
40
40
- exported `t` from `useI18n` (for Composition API mode)
41
-
- injected global `$t` (for Composition API mode)
42
41
:::
43
42
44
43
The following is an example of using the translation API.
45
44
46
45
```html
47
-
<p>{{ $tc('car', 1) }}</p>
48
-
<p>{{ $tc('car', 2) }}</p>
46
+
<p>{{ $t('car', 1) }}</p>
47
+
<p>{{ $t('car', 2) }}</p>
49
48
50
-
<p>{{ $tc('apple', 0) }}</p>
51
-
<p>{{ $tc('apple', 1) }}</p>
52
-
<p>{{ $tc('apple', 10, { count: 10 }) }}</p>
49
+
<p>{{ $t('apple', 0) }}</p>
50
+
<p>{{ $t('apple', 1) }}</p>
51
+
<p>{{ $t('apple', 10, { count: 10 }) }}</p>
53
52
```
54
53
55
-
In the above example of using the `$tc`, the first argument is the locale messages key and the second argument is a number. The `$tc` returns the choice message as a result.
54
+
In the above example of using the `$t`, the first argument is the locale messages key and the second argument is a number. The `$t` returns the choice message as a result.
56
55
57
56
As result the below:
58
57
@@ -91,12 +90,12 @@ The number can be accessed within locale messages via predefined named arguments
0 commit comments