-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
[vite] Error if using HTML tags inside a file referenced by SFC block "src" attribute #124
Comments
Thank you for your reporting! Unfortunately, I could not reproduce this issue. 😞 |
Here I made a min reproduction: The interesting part is that the bug occurs ONLY after first Vite restart. Meaning it will work fine for the first time and never again. ALSO I found another issue. The global
|
Thank you for your reproduction repo! |
Oh, I also realized now that |
Is there any movement on this? For now, I have had to change every instance that contains html from something like this: |
It's even worse with latest because the build won't even go through. Previously, it just wouldn't generate/add the translations. Now the build spits out these errors: ERROR in ../i18n/web/locale/Component.json?vue&type=custom&index=0&blockType=i18n&issuerPath=src%2Fcomponents%2Fcontainer%2Fworkflows%2Fgrids%Component.vue (./node_modules/@intlify/vue-i18n-loader/lib/index.js!../i18n/web/locale/Component.json?vue&type=custom&index=0&blockType=i18n&issuerPath=%2Fsrc%2Fcomponents%2Fcontainer%FComponent.vue) Help! I have like 400+ files that all contain (safe) HTML. Is there really no workaround for this? |
It seems there is a way to toggle strictMessage to false and escapeHtml to true in an options object, just unsure where to place this to get it to work. Inside of our webpack, I have tried to pass in
both on its own and inside of use: [ { options: {xyz}}] but continue to see the errors show on build just editing a bit here: after further looking it would probably go inside of the options when you createI18n() but even setting strictMessage: false, there still yields the errors messages. |
rules: [
{
test: /\.(json5?|ya?ml)$/,
type: 'javascript/auto',
loader: '@intlify/vue-i18n-loader',
options: {
strictMessage: false
},
include: [
require('path').resolve(__dirname, 'src/locales')
]
},
] I tried to pass options like this but it does not work. We have override the package via yarn resolutions to make it work "resolutions": {
"@intlify/vue-i18n-loader/**/@intlify/bundle-utils" : "file:./local_packages/@intlify/bundle-utils"
}, |
Hi @kazupon , Is there any update on this? Can you please suggest how can we add html tags in localization files? Regards |
Up please ? Did someone find a solution ? |
Hi @thibautlukowiak , You can add following to "@nuxtjs/i18n" configuration in nuxt.config.ts. It allows the localization files to have html tags. compilation: { |
Reporting a bug?
Hi, I stumbled upon a weird problem. I have localizations that contain HTML tags and it worked fine while the text was specified inside of
<i18n>
SFC tag, but later I started switching to<i18n src="path/to/file.yaml>
style for easier translation handling and the plugin now doesn't generate the locales. And I narrowed down the cause to whether or not the file has anything resembling an HTML tag e.g.text <string> text
Expected behavior
It shouldn't fail
Reproduction
This works fine:
While this fails:
file.yaml
:Issue Package
vite-plugin-vue-i18n
System Info
Screenshot
No response
Additional context
This issue can be currently avoided by using literal interpolation:
{'<'}
and{'>'}
Validations
The text was updated successfully, but these errors were encountered: