panter / vue-i18next

Internationalization for vue using the i18next i18n ecosystem.
https://panter.github.io/vue-i18next/
176 stars 47 forks source link

`v-t` and HTML in Translation Strings #114

Open straub opened 4 years ago

straub commented 4 years ago

In my apps I have several cases where I'd like to use v-t, but my translations often include HTML content. Since v-t uses el.textContent (https://github.com/panter/vue-i18next/blob/master/src/directive.js#L68), I have to resort to other workarounds like v-html="$t()", which are more verbose and trigger ESLint warnings (b/c ESLint can't know my translations are safe).

Would you be open to a PR that adds an option for v-t to use el.innerHTML instead? Or possibly prefer another approach? I'm willing to put in the work!

Thanks for your time :)