vue-i18n-extract: Does not actually remove keys
When i run npx vue-i18n-extract report --remove --vueFiles './src/components/**/*.?(js|vue)' --languageFiles './i18n/*.json' on my codebase the report correctly identifies the unused keys and says it would delete them but doesn’t actually do it.
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 18
So here’s the issue on my side: my language files are simple key-value pairs in dot notation (hereafter “flat file”):
vue-extract-i18n expects language files to be hierarchical instead (hereafter “hierarchical file”):
Internally,
vue-i18n-extractuses thedot-objectlibrary to convert the hierarchical format to the flat data model.The report creation accidentally works on “flat” language files because
Dot.dotis a no-op on them. But whenvue-i18n-extracttries to actually remove the key, it callsDot.deleteon the flat file, which does not work, asDotexpect a hierarchical file.Vue-i18n-extract’s code does not check the return value from
Dot.delete, so it does not notice that it did not actually delete anything.You can try with this repo https://github.com/WeakAuras/WeakAuras-Companion