Skip to content

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

Open
@TheDutchCoder

Description

@TheDutchCoder

🐛 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions