Skip to content
Advertisement

react-i18next ignores options parameter

I wanted to organize better the language translation files of my project having to nest objects in the language file.

  • Without nesting everything works fine
  • Even nesting objects I can access them by passing the attribute directory in the t() function (ie: t(‘section.subsection.text’)
  • Documentation’s solution doesn’t work for me and I don’t know why

I already tried printing the useTranslation instance to see if it was receiving the “keyPrefix” value but it always says ‘undefined’ either on the t or the fixedT function.

lang file is like this:

JavaScript

the file where I use the useTranslation hook:

JavaScript

this is taken from the documentation

JavaScript

Advertisement

Answer

I had an old node.js version.

Update it (nvm is a great tool for this) and voilà

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement