-
-
Notifications
You must be signed in to change notification settings - Fork 335
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
Interpolations in production mode does not work #1059
Comments
Need to add: vitePlugins: [
[
"@intlify/vite-plugin-vue-i18n",
{
// if you want to use Vue I18n Legacy API, you need to set `compositionOnly: false`
// compositionOnly: false,
runtimeOnly: false,
// you need to set i18n resource including paths !
include: path.resolve(__dirname, "./src/i18n/**"),
},
],
], |
We had the same issue and I can confirm that @gewisser's solution works. Even better with |
close in activity |
It is true that Is there another way to solve this and remaining CSP compliant? |
I should not be forced to compromise on runtimeOnly and I also need to stay CSP compliant as mentioned above. and if I am not wrong there is still no fix with the beta updates up to 9.3.0.beta-17. So, I think this should be opened and fixed again @kazupon. |
Seems to work without CSP violations when setting VueI18nPlugin({
allowDynamic: false, // Prevents CSP violation with `new Function`
runtimeOnly: false, // Keeps translations interpolation
}), Of course we lose the ability to have functions as translations but we don't use them fortunately. This is a workaround but an official solution would still be better... Edit: looks like it doesn't work in all case, I thought the part of the code with |
We couldn't find any working workaround, so we had to revert our whole migration to PS. the special Anyway, thanks for your work ;) |
I was able to solve this (getting translation interpolations without having to add "unsafe-eval" to my CSP) thanks to kazupon's comment in #1457:
vueI18nPlugin({
// This is necessary in order to use i18n parameter interpolation without
// having to put "unsafe-eval" in our CSP:
// https://github.com/intlify/vue-i18n-next/issues/1457
jitCompilation: true,
}), |
For the record, the PS. In the end, we didn't use the |
Thank you for @benlind's solution. |
close by jitCompilation |
Is there an equivalent to this config using Quasar? |
|
Reporting a bug?
In dev mode, interpolation works as expected. Interpolation does not work in production mode.
In dev mode:
In prod mode:
translate:
template:
Expected behavior
In production, interpolation works the same way as in dev mode.
Reproduction
Create a quasar project with vue-i18n integration enabled. Install the latest version of vue-i18n
(9.2.0-beta.37)
. Create a translation with named interpolation and build the projectquasar build
System Info
Screenshot
No response
Additional context
No response
Validations
quasarframework/quasar#13951
The text was updated successfully, but these errors were encountered: