Open andyjamesn opened 2 years ago
I also encountered this issue, and the possible reason is that the initialization of vue-i18n failed due to the lack of config. However, the official example does not require the use of this configuration, so I think it might be a BUG.
Here is my configuration.
export default {
// lazy: true,
// debug: true,
langDir: "assets/i18n/src",
strategy: "prefix",
defaultLocale: "zh-CN",
//! Solved the issue by adding this parameter.
vueI18n: "./assets/i18n/i18n.ts",
locales: [
{ code: "cn", iso: "zh-CN", file: "cn.ts" },
{ code: "en", iso: "en-US", file: "en.ts" },
],
detectBrowserLanguage: {
fallbackLocale: "en",
redirectOn: "all",
},
};
This is the content of ./assets/i18n/i18n.ts.
import cn from "./src/cn";
import en from "./src/en";
export default {
legacy: false,
globalInjection: true,
locale: "cn",
fallbackLocale: "en",
messages: { cn, en },
};
I am generating a static Nuxt 3 build but I am getting the following warning in my console
WARN [intlify] The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return 'message.header'.
I am using adding "@intlify/nuxt3" to nuxt modules with the intlify object and some messages.
I am rendering the translations as follows:
{{ $t("mainLayout.header") }}
Any ideas what is causing this?