@@ -40,7 +40,10 @@ createApp()
40
40
41
41
``` html
42
42
<template >
43
- <div >{{ $t('Hi all') }}</div >
43
+ <div >
44
+ <h1 >{{ $t('Welcome :name!', { name: 'Francisco' }) }}. </h1 >
45
+ <div >Logged in {{ $tChoice('{1} :count minute ago|[2,*] :count minutes ago', 10) }}</div >
46
+ </div >
44
47
</template >
45
48
```
46
49
@@ -74,9 +77,10 @@ trans('Welcome, :name!', { name: 'Francisco' }) // Bem-vindo Francisco!
74
77
trans (' Welcome, :NAME!' , { name: ' Francisco' }) // Bem-vindo FRANCISCO!
75
78
```
76
79
77
- ### ` trans_choice (message: string, count: number)`
80
+ ### ` transChoice (message: string, count: number)`
78
81
79
- The ` trans_choice() ` method can translate a given message based on a count.
82
+ The ` transChoice() ` method can translate a given message based on a count,
83
+ there is also available an ` trans_choice ` alias, and a mixin called ` $tChoice() ` .
80
84
81
85
``` js
82
86
// lang/pt.json
@@ -86,11 +90,11 @@ The `trans_choice()` method can translate a given message based on a count.
86
90
" {1} :count minute ago|[2,*] :count minutes ago" : " {1} há :count minuto|[2,*] há :count minutos" ,
87
91
}
88
92
89
- import { trans_choice } from ' laravel-vue-i18n' ;
93
+ import { transChoice } from ' laravel-vue-i18n' ;
90
94
91
- trans_choice (' There is one apple|There are many apples' , 1 ); // Existe uma maça
92
- trans_choice (' {0} There are none|[1,19] There are some|[20,*] There are many' , 19 ); // Tem algumas
93
- trans_choice (' {1} :count minute ago|[2,*] :count minutes ago' , 10 ); // Há 10 minutos.
95
+ transChoice (' There is one apple|There are many apples' , 1 ); // Existe uma maça
96
+ transChoice (' {0} There are none|[1,19] There are some|[20,*] There are many' , 19 ); // Tem algumas
97
+ transChoice (' {1} :count minute ago|[2,*] :count minutes ago' , 10 ); // Há 10 minutos.
94
98
```
95
99
96
100
### ` loadLanguageAsync(lang: string) `
0 commit comments