Skip to content

Commit a854577

Browse files
committed
improve readme
1 parent 9a8a367 commit a854577

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,29 @@ async function getTranslator() {
3535
return new Translator(translations);
3636
}
3737

38-
const translator = await getTranslator();
38+
const t = await getTranslator();
3939

40-
translator.gettext('hello world'); //ola mundo
40+
t.gettext('hello world'); //ola mundo
4141
```
4242

4343
## Variables
4444

4545
You can add variables to the translations. For example:
4646

4747
```js
48-
translator.gettext('hello :who', {':who': 'world'}); //ola world
48+
t.gettext('hello :who', {':who': 'world'}); //ola world
4949
```
5050

5151
There's also a basic support o sprintf (only `%s` and `%d`)
5252

5353
```js
54-
translator.gettext('hello %s', 'world'); //ola world
54+
t.gettext('hello %s', 'world'); //ola world
5555
```
5656

5757
To customize the translator formatter, just override the `format` method:
5858

5959
```js
60-
translator.format = function (text, ...args) {
60+
t.format = function (text, ...args) {
6161
//Your custom format here
6262
}
6363
```
@@ -69,8 +69,8 @@ Like in the [php version](https://github.com/php-gettext/Translator), there are
6969
```js
7070
//Both functions does the same
7171

72-
translator.gettext('Foo');
73-
translator.__('Foo');
72+
t.gettext('Foo');
73+
t.__('Foo');
7474
```
7575

7676
## API

0 commit comments

Comments
 (0)