nuxt3 icon indicating copy to clipboard operation
nuxt3 copied to clipboard

[Question] Does this module support route prefixes?

Open belegisanin opened this issue 2 years ago • 9 comments

Does this module support route prefixes as described here in nuxt/i18n documentation.

None of these strategies work in my nuxt.config.ts

My nuxt.config.ts file.

import { defineNuxtConfig } from "nuxt";

// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
  modules: ["@nuxtjs/prismic", "@intlify/nuxt3", "@nuxtjs/color-mode"],
  prismic: {
    endpoint: "https://studio-022.prismic.io/api/v2",
  },
  intlify: {
    localeDir: "locales",
    strategy: "prefix_except_default",
    vueI18n: {
      defaultLocale: "en",
      locale: "sr-latn",
      fallbackLocale: "en",
    },
  },
});

Does this feature require additional option configuration or is it not supported at all?

belegisanin avatar Jun 24 '22 10:06 belegisanin

@belegisanin Nuxt community create i18 branch for Nuxt3 https://github.com/nuxt-community/i18n-module/tree/next

packege.json

"devDependencies": {
    "@nuxtjs/i18n": "npm:@nuxtjs/i18n-edge",
    "nuxt": "^3.0.0-rc.5"
},

Im using it, basic function work properly. Prefix works too)) /en/profile /uk/profile etc

SVV-team avatar Jul 14 '22 12:07 SVV-team

@belegisanin Nuxt community create i18 branch for Nuxt3 https://github.com/nuxt-community/i18n-module/tree/next

packege.json

"devDependencies": {
    "@nuxtjs/i18n": "npm:@nuxtjs/i18n-edge",
    "nuxt": "^3.0.0-rc.5"
},

Im using it, basic function work properly. Prefix works too)) /en/profile /uk/profile etc

Is RC5 compatible with the i18n-edge? for some reason I am getting an error after upgrading from RC3 to RC5 Screenshot 2022-07-15 at 17 29 34

CatalinGheorghiu avatar Jul 15 '22 14:07 CatalinGheorghiu

@CatalinGheorghiu

No problem

Снимок экрана 2022-07-18 в 12 00 12 Снимок экрана 2022-07-18 в 12 00 33 Снимок экрана 2022-07-18 в 12 00 56

SVV-team avatar Jul 18 '22 09:07 SVV-team

@CatalinGheorghiu Received same trouble after upgrading (yarn upgrade) But yesterday was new commit on community-i18n, with the last one work perfectly in dev and in production versions.

Try now!

SVV-team avatar Jul 20 '22 16:07 SVV-team

@SVV-team works well except one thing. For me, whenever I change the language within language switcher, the translations are empty, but if i refresh the page, they are shown. Have you tried this?

Catalin-G avatar Jul 21 '22 07:07 Catalin-G

@Catalin-G With config in this message - work perfectly I am already have site in production with translations

Switcher

 <NuxtLink v-for="locale in availableLocales"
          :to="switchLocalePath(locale.code)"
          :key="locale.code" class="dropdown-item">{{ locale.name }}
</NuxtLink>

Maybe trouble with your page / component. Must be only one root "div", if no, behavior is unpredictable

SVV-team avatar Jul 21 '22 15:07 SVV-team

@CatalinGheorghiu

No problem

Снимок экрана 2022-07-18 в 12 00 12 Снимок экрана 2022-07-18 в 12 00 33 Снимок экрана 2022-07-18 в 12 00 56

Yeah, it's running normally. Thank you

senher avatar Aug 08 '22 08:08 senher

@Catalin-G With config in this message - work perfectly I am already have site in production with translations

Switcher

 <NuxtLink v-for="locale in availableLocales"
          :to="switchLocalePath(locale.code)"
          :key="locale.code" class="dropdown-item">{{ locale.name }}
</NuxtLink>

Maybe trouble with your page / component. Must be only one root "div", if no, behavior is unpredictable

Hello, I have a problem. How can I access the $I18N instance in script setup

senher avatar Aug 09 '22 01:08 senher

@Catalin-G With config in this message - work perfectly I am already have site in production with translations Switcher

 <NuxtLink v-for="locale in availableLocales"
          :to="switchLocalePath(locale.code)"
          :key="locale.code" class="dropdown-item">{{ locale.name }}
</NuxtLink>

Maybe trouble with your page / component. Must be only one root "div", if no, behavior is unpredictable

Hello, I have a problem. How can I access the $I18N instance in script setup

I found a solution to the problem in the can use const {vueApp} = useNuxtApp(); const i18n = vueApp.i18n;

senher avatar Aug 09 '22 02:08 senher