79605588

Date: 2025-05-04 12:00:47
Score: 0.5
Natty:
Report link

You need to create i18n folder on root of your project directory.

enter image description here

in i18n/i18n.config.ts define config like this

import fr from "./fr.json";
import en from "./en.json";


export default defineI18nConfig(() => ({
  legacy: false,
  messages: {
    fr: fr,
    en: en,
   
  },
  // baseUrl: url// not working from here


}));


And then in nuxt.config.ts

  i18n: {
    debug: true,
    locales: [
      { code: "fr", iso: "fr-BE", dir: "auto" },
      { code: "en", iso: "en-GB", dir: "auto" },
      
    ],
    strategy: "prefix",
    defaultLocale: "en",
    // defaultLanguage: "en",
    detectBrowserLanguage: false,
    baseUrl: url.substr(0, url.length - 1) || "https://example.com",
    vueI18n: "./i18n.config.ts", // if you are using custom path, default
  },

Please note path here is "./i18n.config.ts" somehow i18n lib using directory i18n as its root.
Thanks me later :wink

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Arsalan Maqsood