Skip to content
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

Nuxt 3 Generate - The message format compilation is not supported in this build #80

Open
andyjamesn opened this issue Jul 28, 2022 · 1 comment

Comments

@andyjamesn
Copy link

andyjamesn commented Jul 28, 2022

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?

@prayface
Copy link

prayface commented May 2, 2023

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 },
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants