mxmvshnvsk / i18n-unused

The static analyze tool for finding, marking and removing unused and missing i18n translations in your JavaScript project
MIT License
128 stars 21 forks source link

add custom function to verify if a key is used #37

Closed YeisonAndreyLiCe closed 1 year ago

YeisonAndreyLiCe commented 1 year ago

Hi there!

On one hand I updated some dependencies, on the other hand I added a new optional custom parameter to the configuration, that aiming to allow user workaround whit false positives when detecting unused keys, I have realized that string interpolation (${}) is a problem. While i18next extracts translation keys in runtime, i18n-unused doesn't run the code, so it can't interpolate values in these expressions.

implementation example:

image

Note: the approach in the image can increase the number of false negatives when detecting unused keys, but it is that: an approach.

I have probe the tool adding the dependency from the repo in my perfil, npm install --save-dev https://github.com/YeisonAndreyLiCe/i18n-unused.git it works as expected. Additionally all existent tests have passed.

regards,

mxmvshnvsk commented 1 year ago

Hi, thx for PR, I'll look at this week, a lot of work, sorry.