Activities

halilyuce

halilyuce posted a new question

nuxt-i18n •

How Can I Change URL When User Change Language?

Im using the dynamic route for show single post page, I`m sending category slug and post name slug as parameters to show it.

Link:

:href="localePath({
name: 'news-category-post',
params: {
category: post.categories ? post.categories[0].slug : '',
post: post.slug
}
})

Route :

'news/category/post': {
en: /news/:category/:post,
es: /pronosticos/:category/:post,
pt: /prognostics/:category/:post,
},
When users change the language on the post page How can I change post slug with a new one? Im using i18n plugin for multilanguage website.

English URL : http://en.localhost:3000/news/soccer/dortmund-barcelona-champions-2019-matchday-5

Expected ESP URL : http://localhost:3000/pronosticos/futbol/barcelona-dortmund-champions-2019-jornada-5

I added all slugs to API result and I can use what I want.

1McTK.png

lukeXcze

lukeXcze posted a new bug report

nuxt-i18n •

bug switchLocalePath for disabled paths

Version

v5.3.0

Reproduction link

https://codesandbox.io/s/switchlocalepath-for-disabled-pages-rnppi

Steps to reproduce

  • switch language to "en"
  • visit "en-only-page"
  • try to switch language to "cs" (issue 1)
  • check SEO generated metadata (issue 2)

What is expected ?

(issue 1): switchLocalePath('cs') resolved to "/" path,
or new vueI18n option

(issue 2): no SEO in DOM head>link[hreflang="cs-CZ"]
page in this languge is not defined

What is actually happening?

(issue 1): switchLocalePath generated link to "cs" is same as actual "en" page

(issue 2): SEO in DOM: head>link[hreflang="cs-CZ"] links to "en" vesion

Additional comments?

// nuxt-i18n in version 6.4.0 (unable to select higher than 5.3.0 while creating new issue for nuxt-i18n module)

// i suggest to define new vueI18n option fallback for pages without lng alternative

angelsagredo

angelsagredo posted a new question

nuxt-i18n •

ignore nested dynamic route

Hi, I have this pages folder structure:

pages

  • page1.vue
  • page2.vue
  • pagen.vue
  • to/_id.vue

How can I disable prefix translation for route /to/_id.vue ?

I checked the docs https://nuxt-community.github.io/nuxt-i18n/routing.html#ignore-routes
It works only for a normal page (page1.vue for example), but not for nested routes.

alex-eri

alex-eri posted a new question

nuxt-i18n •

Per components i18n mixed with per page and langDir

If i put <i18n> on layout it has messages only from this tag. Messages loaded in root not displayed. There is new VueI18n instance in $i18n.

How to fix it?

mirzaevra

mirzaevra posted a new question

nuxt-i18n •

Empty messages object in lazy mode

"nuxt-i18n": "6.4.0"
lazy: true // mode

If the current locale matches the newly selected locale, the messages object is returned empty (translation from the file is not loaded). When the application is initialized when the translation phrase does not match the key in the messages object, the method "$t" returns the key and not the phrase corresponding to it

There was no such check in version 6.0.1 and plugin worked perfectly!

// Abort if newLocale did not change
 if (newLocale === app.i18n.locale) {
     return
 }

Please tell me the solution. Thanks

wahidrahim

wahidrahim posted a new bug report

nuxt-i18n •

bug Visiting a locale version of the website redirects to home page (default locale).

Version

v6.4.0

Reproduction link

https://upbeat-mccarthy-caa106.netlify.com/fr

Steps to reproduce

  1. Open a new Incognito browser:

  2. Visit https://upbeat-mccarthy-caa106.netlify.com/fr

Notice it redirects to: https://upbeat-mccarthy-caa106.netlify.com/

Try visiting https://upbeat-mccarthy-caa106.netlify.com/fr again, but this time it will show the French version as expected.

What is expected ?

It should go directly to the French version: https://upbeat-mccarthy-caa106.netlify.com/fr

What is actually happening?

It redirects to English (default) locale: https://upbeat-mccarthy-caa106.netlify.com/

Additional comments?

How to make it so it goes to the selected locale version as expected?

Alligatore3

Alligatore3 posted a new question

nuxt-i18n •

Cannot translate the value of keypath...
[vue-i18n] Cannot translate the value of keypath $something. Use the value of keypath as default.

I have a lot of this warnings in my console.
I tried everything.

This is my nuxt-configuration:

  modules: [
    ...
    ['nuxt-i18n', {
      locales: [
        {
          name: 'English',
          code: 'en',
          iso: 'en-EN',
          file: 'en-EN.js'
        },
        {
          name: 'Italiano',
          code: 'it',
          iso: 'it-IT',
          file: 'it-IT.js'
        }
      ],
      seo: false,
      lazy: true,
      langDir: 'lang/',
      defaultLocale: 'it'
    }],
    ...
  ],

Also lazy load is useless

No progess.

I've also built a plugin to handle some warnings:

Vue.prototype.$translate = function (path, optVal = EMPTY_VALUE) {
  if (path.includes('.null') || path.includes('.undefined')) return optVal
  return this.$t(path) === path || !this.$t(path)
    ? optVal
    : this.$t(path)
}
bayun2

bayun2 posted a new bug report

nuxt-i18n •

bug no param support in getRouteBaseName

Version

v6.3.1

Reproduction link

https://jsbin.com/?html,js,output

Steps to reproduce

app.getRouteBaseName(route.to)

What is expected ?

give the name where route will going

What is actually happening?

give the name of current route

Additional comments?

My old project use getRouteBaseName to get route's name ,not only get current route name

bayun2

bayun2 posted a new question

nuxt-i18n •

v6.3.1 no param support in getRouteBaseName

I use it like app.getRouteBaseName(to) in my project by v6.3.0, But in v6.3.1 this method can't support param , so mycode can't work by this change

bayun2

bayun2 posted a new question

nuxt-i18n •

v6.3.1 no param support in getRouteBaseName, I use it like app.getRouteBaseName(to) in project, it's can't work by this change
krutijan1

krutijan1 posted a new bug report

nuxt-i18n •

bug Flash of content of default locale

Version

6.3.1

Reproduction link

https://staging--apitalks-store.netlify.com/

Steps to reproduce

  • Open the link

  • Page loads ssr in Czech language, then during hydrate default locale is applied (English), it switches, then it switches back to Czech. Can you please help with how this thing could get going ?

What is expected ?

No flash of default locale during hydratation

What is actually happening?

Page loads ssr in Czech language, then during hydrate default locale is applied (English), it switches, then it switches back to Czech.

lifenautjoe

lifenautjoe posted a new question

nuxt-i18n •

How to use this together with router-module

When using router-module (https://github.com/nuxt-community/router-module), the page parsing is disabled.

Checking the available routes I can see that no localized routes are generated for my defined routes in router.js

import Vue from 'vue';
import Router from 'vue-router';

import WaffleAboutPage from '~/pages/about/about.vue';
import WaffleOurStoryPage from '~/pages/our-story/our-story.vue';

Vue.use(Router);

export function createRouter() {
  return new Router({
    mode: 'history',
    routes: [
      {
        path: '/',
        name: 'about',
        component: WaffleAboutPage,
      },
      {
        path: '/our-story',
        name: 'our-story',
        component: WaffleOurStoryPage,
      },
    ]
  })
}

Show a warning when trying to use with localePath('about')

Route with name '/about___en' does not exist

How can I make sure this plugin picks up the declared routes in there?

mercs600

mercs600 posted a new feature request

nuxt-i18n •

idea custom middleware cause conflicts with other module

What problem does this feature solve?

Hi guys,
this line https://github.com/nuxt-community/nuxt-i18n/blob/56ae21a27bab9bc03dffbe7015cd85a843ce2d88/src/index.js#L133 adds custom middleware with key i18n

Our module does exactly the same thing, so we have conflict here. Obviously we should change the key name on our side, but I think this module should do the same, because this is tricky to debug.

What do you think ? I can prepare some PR to fix that.

ZhongkaiChen

ZhongkaiChen posted a new bug report

nuxt-i18n •

bug failure for android mobile phone

Version

v6.3.0

Reproduction link

https://codesandbox.io/s/codesandbox-nuxt-vovsx

Steps to reproduce

Just follow the basic introduction.

What is expected ?

Working on an Android mobile phone.

What is actually happening?

For android phone, when I open the webpage https://vovsx.sse.codesandbox.io/
I cannot switch languages.

Additional comments?

This issue is quite important since there are so many android phones out there.

oyed

oyed posted a new question

nuxt-i18n •

Lazy-load YAML Translations?

Is it possible to lazy-load YAML translations? These are the translations outside of Nuxt Pages. E.g. when defining locales in nuxt.config.js:

i18n: {
        locales: [
            {
                code: 'de',
                iso: 'de-DE',
                file: 'de/index.js',
            },
        ],
},

Is there a way to generate the .js files from .yaml files to allow loading them this way? Otherwise, using YAML for page components and JS/JSON for global translations, it becomes a bit cumbersome.

rchl

rchl posted a new bug report

nuxt-i18n •

bug Fails to redirect to locale on initial navigation with router in hash mode

Version

v6.3.0

Reproduction link

https://codesandbox.io/s/nuxt-i18n-router-in-hash-mode-tl28z

Steps to reproduce

  1. In nuxt.config.js add: router: { mode: 'hash' }
  2. Configure nuxt-i18n to redirect to locale:
      "nuxt-i18n",
      {
        locales: ["en"],
        detectBrowserLanguage: {
          alwaysRedirect: true,
          fallbackLocale: "en"
        },
        vueI18n: {
          fallbackLocale: 'en',
          messages: {
            en: {
              welcome: "Welcome"
            }
          }
        }
      }
  1. Go to http://localhost:3000

What is expected ?

Index route is rendered

What is actually happening?

Blank page is shown

miteyema

miteyema posted a new feature request

nuxt-i18n •

idea SEO: missing region-independant link for language

What problem does this feature solve?

When enabling the seo option, the plugin correctly generates <link rel="alternate" hreflang="x"> tags for every language configured in nuxt.config.js.
However, it is also recommended to generate a catchall URL for geographically unspecified users of that language.
For example, you may have specific URLs for English speakers in Ireland (en-ie), Canada (en-ca), and Australia (en-au), but should also provide a generic English (en) page for searchers in, say, the US, UK, and all other English-speaking locations. It can be one of the specific pages, if you choose.

Please see https://support.google.com/webmasters/answer/189077 for more information.

What does the proposed changes look like?

We already have the properties code (e.g. en) and iso (e.g. en-AU) in the locales object when configuring the module in nuxt.config.js.
We could use the code property to generate the catchall URL tag.

paulvonber

paulvonber posted a new question

nuxt-i18n •

Ignore routes dynamicaly

is there anyway to show/ignore routes dynamicaly? https://nuxt-community.github.io/nuxt-i18n/routing.html#ignore-routes
for example if I have few clients and they can have a setting to show certain pages in certain languages, seems like with current approach I can't really do this as In component settings is taken during the build. Any suggestions how do I overrun this?

andrewvasilchuk

andrewvasilchuk posted a new question

nuxt-i18n •

Types not working

Screenshot_1.png

I am getting the following error. How do I solve it? nuxt-i18n is installed.

Borisstoy

Borisstoy posted a new feature request

nuxt-i18n •

idea Allow "sameSite" for detectBrowserLanguage cookie configuration

What problem does this feature solve?

As per Chrome requirement:

A cookie associated with a cross-site resource at http://cloudflare.com/ was set without the SameSite attribute.

In order to be able to use cookies for browsers language detection, we need the "sameSite" option while setting the "i18n_redirected" cookie.

What does the proposed changes look like?

Add an extra option "sameSite", boolean value.

detectBrowserLanguage: {

sameSite: true

},