Objects and Arrays
Objects
You can return objects or arrays to be used by third party modules localization:
keys
{
"tree": {
"res": "added {{something}}"
},
"array": ['a', 'b', 'c']
}sample
i18next.t('tree', { returnObjects: true, something: 'gold' });
// -> { res: 'added gold' }
i18next.t('array', { returnObjects: true });
// -> ['a', 'b', 'c']i18next.t($ => $.tree, { returnObjects: true, something: 'gold' });
// -> { res: 'added gold' }
i18next.t($ => $.array, { returnObjects: true });
// -> ['a', 'b', 'c']The returned value supports interpolation, plurals, nesting, ...
returnObjects can be set to true on init.
Arrays
You can access array values or join them.
keys
sample
The returned value supports interpolation, plurals, nesting, ...
joinArrays can be set to a value on init.
Last updated