8

I have upgraded an app from using webpack-i18n for translations to using i18next (13.1.5). For the most part, everything worked, but on one particular page, none of the text from one of my ejs files is loading. The js file for that page makes a few calls to i18next.t under specific circumstances, and if I trigger them, the text for those Strings is successfully retrieved and displayed. The ejs file still appears to be getting processed, because the structure and the images are all correct.

I can't find any errors that explain what's happening and I'm not sure how to find out what's going on with i18next on this page. I have debug: true on for i18next, and I can see the entire config in the browser console. This includes the resources, with a complete listing of the translation key/value pairs. So it seems like i18next is finding all the Strings and loading them up. But any reference to them in this one ejs file is coming up with nothing.

We only have en translations, and in the i18next config, the lng and fallbackLng are both en. So I don't think it's possible that the app thinks it needs to use a different language for this one template file, and is looking for an alternate translation that doesn't exist. I would imagine that would also prompt it to error in some way.

There are no errors in the console. So, how do I find out more about what i18next thinks is going on in this situation? I can't tell if it is actually hitting and evaluating these calls in the ejs file and thinks that null is the correct response, or if it's somehow not evaluating any of these Strings at all, or if it's actually hitting some sort of an error and the errors just aren't reaching me.

It's more puzzling since the other pages work, and even the Strings from the js file for this page are working. I can't find anything different between the ejs files that work and the one that doesn't. It seems unlikely that an issue with one of the referenced Strings, or some of them, would cause all of the Strings in the file to fail, especially if it did so silently. Thoughts? I'm completely new to i18next and not great with Javascript in general, so I'm at a loss how to debug further.

Jack Bashford
  • 43,180
  • 11
  • 50
  • 79
James Martineau
  • 951
  • 1
  • 13
  • 29
  • 2
    Can you provide a sample that reproduces this issue? – adrai Apr 19 '19 at 20:12
  • 1
    As @adrai mentioned, could you provide an example on jsfiddle or something similar so we can see your code? As a starter, this is the example jsfiddle included in the i18next docs. https://jsfiddle.net/jamuhl/dvk0e8a9/#tabs=js,result,html – Todd Chaffee Apr 20 '19 at 20:42

0 Answers0