gatsby-plugin-react-i18next icon indicating copy to clipboard operation
gatsby-plugin-react-i18next copied to clipboard

missingKeyHandler and parseMissingKeyHandler not working

Open LucasBassetti opened this issue 2 years ago • 2 comments

Hi, I'm trying to use the missingKeyHandler and parseMissingKeyHandler but it's not working. When I try to do some like that:

{
  resolve: `gatsby-plugin-react-i18next`,
  options: {  
    ...
    i18nextOptions: {
      debug: true, // if true, you can see errors in console
      saveMissing: true,
      missingKeyHandler: function () {
        console.log("missingKeyHandler");
      },
      parseMissingKeyHandler: function () {
        console.log("parseMissingKeyHandler");
      },
      ...
    }
  }
}

I'm getting this from debug

saveMissing: true,
missingKeyHandler: false,
parseMissingKeyHandler: false,

Does anyone know how to use them?

LucasBassetti avatar Nov 17 '21 16:11 LucasBassetti

Experiencing this same issue, wondering if anyone has found a fix yet?

chapmanm3 avatar Jan 14 '22 17:01 chapmanm3

@LucasBassetti The useTranslation hook exposes the i18n instance along with the t() function. I've worked around this issue by calling i18n.on('missingKey') inside my root components where needed. Hope that helps.

chapmanm3 avatar Jan 25 '22 16:01 chapmanm3