Refactoring translator to use "_" instead of "translator._".
This is shorter and pollutes less the code.
This commit is contained in:
parent
1789f36a63
commit
51c3f1d972
34 changed files with 174 additions and 190 deletions
|
@ -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"
|
||||
});
|
||||
```
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue