File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff 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
4545You 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
5151There'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
5757To 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
You can’t perform that action at this time.
0 commit comments