i18next / i18next-parser

Parse your code to extract translation keys/values and manage your catalog files
MIT License
486 stars 198 forks source link

keepRemoved doesn't work with specified array of patterns #1017

Open Mormen opened 4 months ago

Mormen commented 4 months ago

🐛 Bug Report

I'm using i18next-parser and I would like to remove unused keys, but exclude some patterns.

To Reproduce

From docs keepRemoved: false, // Keep keys from the catalog that are no longer in code // You may either specify a boolean to keep or discard all removed keys. // You may also specify an array of patterns: the keys from the catalog that are no long in the code but match one of the patterns will be kept. // The patterns are applied to the full key including the namespace, the parent keys and the separators.

Your Environment

McFixitMan commented 4 months ago

Try using a regular expression literal instead of putting your pattern inside a string, e.g. keepRemoved: [/\binterval\w*\b/]