Closed parafeu closed 1 year ago
Thank you for your reporting!
Unfortunately, I could not reproduce with your reporting. 😞 We need minimal reproduction repo via github, or stackbliz. Could you give it to us please ? 🙏
Hey ! Thanks for your answer. Here is a minimal reproduction repo I just created. https://github.com/parafeu/reproduction-unplugin-i18n
Thank you for your repo!
I realized that locale resources doesn’t set up on it.
You need to configure src/lang
into include
option at vite.config.ts
:
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";
import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite";
+import { fileURLToPath } from "url";
+const __dirname = fileURLToPath(new URL(".", import.meta.url))
export default defineConfig({
resolve: {
alias: {
"@src/": `${path.resolve(__dirname, "src")}/`
}
},
plugins: [
vue(),
VueI18nPlugin({
globalSFCScope: true,
+ include: [path.resolve(__dirname, "src/lang/**")]
})
]
});
If the above settings do not solve your issue, please let us know in this comment. Thanks!
@kazupon I stumbled on this myself while migrating to @intlify/unplugin-vue-i18n
It was not necessary to specify include
while using Vite 3 and @intlify/vite-plugin-vue-i18n
. Is it expected that we now have to specify it?
@cexbrayat Sorry, late my reply.
It was not necessary to specify include while using Vite 3 and @intlify/vite-plugin-vue-i18n. Is it expected that we now have to specify it?
That is required if resources such as json
or yaml
are read from external sources.
If you would use only SFC's i18n custom block, it is not required.
Reporting a bug?
After migrating from @intlify/vite-plugin-vue-i18n to @intlify/unplugin-vue-i18n , all pluralization and interpolation stopped working in production
Expected behavior
Messages should render like this (working in developpement)
In production, it looks like this
Reproduction
Using Vite 4.0.1 and @intlify/unplugin-vue-i18n 0.8.1.
vue 3.2.45 vue-i18n 9.2.2 typescript 4.9.4
Plugin configuration :
Here is some messages not working :
"date": "Date | Dates"
"from_to": "Du {from} au {to}"
Usage in component
Issue Package
unplugin-vue-i18n
System Info
Screenshot
No response
Additional context
No response
Validations