i18n icon indicating copy to clipboard operation
i18n copied to clipboard

Wrong locale set in asyncData context

Open dreitzner opened this issue 3 years ago • 0 comments

setup

  • I am working on a static page with multiple languages
  • I have one dynamic entrypoint (pages/_.vue)
  • The page generation is based on the result of an api call that happens inside of asyncData
  • The CMS needs the correct language code + the url/slug to retrieve the correct page

the issue

When I execute npm run generate all routes get generated correctly, except for the base route of the none default language. In my example that would be /hr for the croation language. The context has the following values set:

{
  url: '/hr',
  i18n: {
    code: 'en',
    iso: 'en-US',
    name: 'English'
  },
  route: {
    name: 'all___en',
    meta: [
      {}
    ],
    path: '/hr',
    hash: '',
    query: {},
    params: {
      pathMatch: 'hr'
    },
    fullPath: '/hr',
    matched: [
      [Object]
    ]
  }
}

If more infos are needed, feel free to ask :)

dreitzner avatar Apr 15 '22 08:04 dreitzner