Closed Zauberbutter closed 2 years ago
Thank you for your reporting!
I tried to reproduce using vue-cli, so, unfortunately, I could not this issue. :disappointed:
From your reporting, it looks like you are using the config chainWebpack to configure it.
As mentioned in the readme, vue-cli-plugin-i18n is a plugin for vue-cli.
This plugin, @intlify/vue-i18n-loader
, is built-in and configured as well.
Could you give a minimal reproducing GitHub repo that reproduces in your environment, please?
Thank you for your answer!
I reproduced this here → https://github.com/Zauberbutter/vue-i18n-test
I think it could be, that I'm using sharedMessages
with just a typescript file, which doesn't get compiled.
Thank you for your quick reply and giving repo! I'll try to reproduce it!
I think it could be, that I'm using sharedMessages with just a typescript file, which doesn't get compiled.
Yes! You need to use messages
options at createI18n
function
Ok! And what is sharedMessages
for?
You can see the docs https://kazupon.github.io/vue-i18n/guide/component.html#shared-locale-messages-for-components
sharedMessages
is useful if you are handling messages on a per-component (i.e. local) basis, rather than globally.
So I'm using <i18n>
blocks too, so i thought I need to use sharedMessages
. I think the use case for sharedMessages
should be better explained in the docs.
Now that I'm using the loadLocaleMessages
function together with JSON files in /locales
it's working. But I'm getting an warning for each key that isn't in local scope. Just like in https://github.com/intlify/vue-cli-plugin-i18n/issues/191
But it is working nevertheless.
Thank you for your feedback!
I'll add the sharedMessages
to docs later!
Happy coding! :)
Module versions
@intlify/vue-i18n-loader: ^4.0.0 @vue/cli-plugin-babel: ^5.0.0-rc.0 @vue/cli-service: ^5.0.0-rc.0 vue-cli-plugin-i18n: ~2.3.1 vue-i18n: ^9.1.9
Config
vue.config.js
:i18n.ts
:Description
So I've ran into Content-Security setting problems and noticed, that I have to set
runtimeOnly
totrue
. But now I'm getting many errors like this:I've searched for this issue and found out, that I have to set an alias for webpack. But I thought I dont need to do that, because I am using the vue cli plugin. Additionally according to https://vue-i18n-next.intlify.dev/installation.html#with-a-bundler
@intlify/vue-i18n-loader
already precompiles the messages. So how to solve this?