Refactoring translator to use "_" instead of "translator._".

This is shorter and pollutes less the code.
This commit is contained in:
David Négrier 2022-01-19 09:28:08 +01:00 committed by Alexis Faizeau
parent 1789f36a63
commit 51c3f1d972
34 changed files with 174 additions and 190 deletions

View file

@ -73,10 +73,12 @@ Example:
}
```
In the code you can use it like this:
In the code you can translate using `translator.translate`, or the shortcut alias: `_`.
```js
translator._('messages.coffe-machine.start');
import { _ } from "../../Translator/Translator";
console.log(_('messages.coffe-machine.start'));
```
### Add a key with parameters
@ -99,7 +101,7 @@ Example:
In the code you can use it like this:
```js
translator._('messages.coffe-machine.player-start', {
_('messages.coffe-machine.player-start', {
playerName: "John"
});
```
```