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

fix: Devtools breaks unimport-vue-i18n when using HTML in string translations #572

Open
TheDutchCoder opened this issue Jan 11, 2024 · 5 comments
Labels
bug Something isn't working has workaround upstream

Comments

@TheDutchCoder
Copy link

TheDutchCoder commented Jan 11, 2024

🐛 The bug

Vue-i18n allows HTML in string translations by setting strictMessage: false in the config. This allows users to easily embed HTML in their translations.

In SFC's you can add a <i18n> block with translations, but if those string contain HTML, Devtool attaches a data-v-inspector attribute and that breaks unimport-vue-i18n in the process.

I think the underlying issue is that the double quotes from the data attribute terminate the string?

🛠️ To reproduce

https://stackblitz.com/edit/nuxt3-issue-unplugin-vue-i18n-4dw9xe?file=nuxt.config.ts

🌈 Expected behavior

Devtools to not process HTML from string translations (or at least not to break them 😄 )

ℹ️ Additional context

Toggle the devtools on/off to see it works with the devtool disabled, but breaks with it enabled.

@TheDutchCoder TheDutchCoder added the bug Something isn't working label Jan 11, 2024
@arashsheyda
Copy link
Member

arashsheyda commented Jan 11, 2024

You can fix it by disabling componentInspector:

devtools: {
    enabled: true,
    componentInspector: false,
  },

@TheDutchCoder
Copy link
Author

@arashsheyda thanks, will this break/limit any of the devtools functionality?
If so, then that wouldn't be great, of course.

@arashsheyda
Copy link
Member

@TheDutchCoder unfortunately yes, you can't use the component inspector, as DevTools is using vite-plugin-vue-inspector for component inspection. but everything else would work just fine!

@TheDutchCoder
Copy link
Author

@arashsheyda Ok, then let's leave this open as a bug, because we really would like to be able to use both 😉

@TheDutchCoder
Copy link
Author

Any chance this could be picked up?
Can we also remove the "has workaround" label? Disabling devtools is not really a "workaround" imo 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has workaround upstream
Projects
None yet
Development

No branches or pull requests

2 participants