@@ -56,9 +56,9 @@ createApp().use(i18nVue, {
56
56
})
57
57
```
58
58
59
- ### ` trans() `
59
+ ### ` trans(message: string ) `
60
60
61
- The ` trans() ` method can be used on
61
+ The ` trans() ` method can translate a given message.
62
62
63
63
``` js
64
64
// lang/pt.json
@@ -74,7 +74,26 @@ trans('Welcome, :name!', { name: 'Francisco' }) // Bem-vindo Francisco!
74
74
trans (' Welcome, :NAME!' , { name: ' Francisco' }) // Bem-vindo FRANCISCO!
75
75
```
76
76
77
- ### ` loadLanguageAsync() `
77
+ ### ` trans_choice(message: string, count: number) `
78
+
79
+ The ` trans_choice() ` method can translate a given message based on a count.
80
+
81
+ ``` js
82
+ // lang/pt.json
83
+ {
84
+ " There is one apple|There are many apples" : " Existe uma maça|Existe muitas maças" ,
85
+ " {0} There are none|[1,19] There are some|[20,*] There are many" : " Não tem|Tem algumas|Tem muitas" ,
86
+ " {1} :count minute ago|[2,*] :count minutes ago" : " {1} há :count minuto|[2,*] há :count minutos" ,
87
+ }
88
+
89
+ import { trans_choice } from ' laravel-vue-i18n' ;
90
+
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.
94
+ ```
95
+
96
+ ### ` loadLanguageAsync(lang: string) `
78
97
79
98
The ` loadLanguageAsync() ` can be used to change the location during the runtime.
80
99
0 commit comments