Essentials
Accessing keys
resources with 2 keys:
sample
Passing a default value
You can pass in a default value for cases the key could not be found in translations like:
In case you're using the saveMissing functionality, it will also pass the defaultValue to your chosen backend, like shown in this React.js example.
Accessing keys in different namespaces
Namespaces are a feature in i18next internationalization framework which allows you to separate translations that get loaded into multiple files.
init
moduleA.json
common.json
sample
Multiple fallback keys
Calling the t function with an array of keys enables you to translate dynamic keys providing a non specific fallback value.
As a sample think of an error code you get and you like to show a specific warning in some cases:
keys
sample
Overview options
i18next.t(key, options)
Last updated