How to check missing translation keys in transloco?

3.8k Views Asked by At

I am currently using Transloco to do my translations in angular application. I have 2 files in my assets:

  • en.json with values:

    { "firstName": "First Name", "lastName": "Last Name", "address": "Address" }

  • fr.json with values (lastName missing):

    { "firstName": "First Name", "address": "Address" }

I am doing the translation for values retrieved from the backend and not using them directly. So all these keys are flagged up as extra keys when I use the command:

npm run i18n:find

The consequence is that it is impossible to know if Last Name is missing from the french translation file. Is there a way/command to compare the translation files with each other and see which files has missing translations?

1

There are 1 best solutions below

0
On

Found your question because I was searching for this answer myself.

There is a library for that: https://github.com/ngneat/transloco-keys-manager

From its documentation:

This tool detects two things: First, it detects any key that exists in one of your translation files but is missing in any of the others. Secondly, it detects any key that exists in the translation files but is missing from any of the templates or typescript files.

And because there is one, I guess this feature is just not implemented by transloco.