Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linked messages are incorrectly reported as unused #182

Open
JoostKersjes opened this issue Sep 9, 2022 · 0 comments
Open

Linked messages are incorrectly reported as unused #182

JoostKersjes opened this issue Sep 9, 2022 · 0 comments

Comments

@JoostKersjes
Copy link

JoostKersjes commented Sep 9, 2022

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

  1. Create minimal Vue repo
  2. Set up vue-i18n
  3. 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>
  1. Run npx vue-i18n-extract report --vueFiles './src/App.vue' --languageFiles './src/locales/*.?json'
  2. "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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant