vue-i18n-extract
vue-i18n-extract copied to clipboard
Linked messages are incorrectly reported as unused
Linked messages can be used to combine existing messages into one larger message.
From what I can tell, vue-i18n-extract only checks the vueFiles to determine if a message is used or not, while the languageFiles also can use their own messages with this feature.
Steps to reproduce
- Create minimal Vue repo
- Set up
vue-i18n - Add following files:
src/locales/en-GB.json
{
"message": {
"the_world": "the world",
"dio": "DIO:",
"linked": "@:message.dio @:message.the_world !!!!"
}
}
src/App.vue
<template>
<p>{{ $t("message.linked") }}</p>
</template>
- Run
npx vue-i18n-extract report --vueFiles './src/App.vue' --languageFiles './src/locales/*.?json' "message.the_world"and"message.dio"are reported as unused
What you expected would happen
Messages used to create linked messages to not be reported as unused.
My suggestion: Treat any message linked referenced with the @: syntax as used. If the message making the reference is deleted (because that message is maybe unused), the linked message will no longer be referenced, and should once again be reported as unused.
What actually happens
Messages used to create linked messages are reported as unused.
If you run npx vue-i18n-extract report --remove in this project, the App will break.