2

I'm using i18next to internationalize my React web application with typescript. When I process the text, it outputs the following:

Running string extraction on source files
Finding source files to process
Running xgettext
Extracting text for language en
Translation file was found - merging translations
..............................
Read 1 old + 1 reference, merged 266, fuzzied 0, missing 30, obsolete 27.
Running xgettext
Extracting text for language fr
Translation file was found - merging translations
..............................
[... other languages]

So I have 30 keys that are missing, but somehow I can't find a way to know exactly which 30 string keys are missing...

The only way I can currently find a missing key is if I open the console of my browser and when one of my React components is rendered if it contains a missing key, it prints:

i18next::translator: missingKey en translation my_missing_string my_missing_string

(Yes it prints it twice on the same line)

But, I am not going to try and render every single possible component depending on use cases since we have over 300 different strings.

How is i18next able to tell me that 30 are missing but not able to show which ones, I must be missing somthing.

Antoine
  • 800
  • 3
  • 14
  • 29

2 Answers2

4

what extraction tool are you using? seems to be from some gettext implementation - not related to i18next...

try one of those:

jamuhl
  • 4,352
  • 2
  • 25
  • 31
0

This solution proposes another approach, which works great for our team : using translation files as a type, to validate parameters of the translation function.

So instead of finding missing keys, TpeScript will be able to tell you that the key you just entered does not exist.

Florian Motteau
  • 3,467
  • 1
  • 22
  • 42