Skip to content

Commit 43ab5e1

Browse files
committed
docs: Improve documentation.
1 parent 26a3f5c commit 43ab5e1

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ createApp().use(i18nVue, {
5656
})
5757
```
5858

59-
### `trans()`
59+
### `trans(message: string)`
6060

61-
The `trans()` method can be used on
61+
The `trans()` method can translate a given message.
6262

6363
```js
6464
// lang/pt.json
@@ -74,7 +74,26 @@ trans('Welcome, :name!', { name: 'Francisco' }) // Bem-vindo Francisco!
7474
trans('Welcome, :NAME!', { name: 'Francisco' }) // Bem-vindo FRANCISCO!
7575
```
7676

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)`
7897

7998
The `loadLanguageAsync()` can be used to change the location during the runtime.
8099

0 commit comments

Comments
 (0)