Skip to content

useLocaleHead throws "[vue-i18n-routing] Locale ISO code is required to generate alternate link" Error when using locales, lang dir & nuxt module array config style #2617

Closed
@lautr

Description

Environment

@nuxtjs/i18n: 8.0.0-rc.9

  • Operating System: Linux
  • Node Version: v18.18.0
  • Nuxt Version: 3.8.2
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: npm@9.4.2
  • Builder: -
  • User Config: devtools, modules
  • Runtime Modules: @nuxtjs/i18n@8.0.0-rc.9
  • Build Modules: -

Reproduction

Configure the Module using locales & langdir using the Nuxt Module Config Array style like:

 modules: [
    [
      '@nuxtjs/i18n',
      {
        defaultLocale: 'de',
        langDir: './translations',
        locales: [
          {
            code: 'de',
            file: 'de-DE.ts',
            iso: 'de-DE',
          },
        ],
      }
    ],
  ],

and use useLocaleHead anywhere

Can be reproduced here:

https://github.com/lautr/bug-nuxtjs-i18n

https://stackblitz.com/~/github.com/lautr/bug-nuxtjs-i18n

Describe the bug

useLocaleHead throws "[vue-i18n-routing] Locale ISO code is required to generate alternate link" Error when using locales, lang dir & nuxt module array config style.

Additional context

Can be reproduced here:

https://github.com/lautr/bug-nuxtjs-i18n

https://stackblitz.com/~/github.com/lautr/bug-nuxtjs-i18n

Logs

No response

Metadata

Assignees

No one assigned

    Labels

    v8🔨 p3-minor-bugPriority 3: a bug in an edge case that only affects very specific usage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions