Skip to content

Support i18n locales options #262

@tonqa

Description

@tonqa

Currently, I use following config in nuxt.config.js:

  i18n: {
    parsePages: false,
    locales: [
      {
        code: "en",
        iso: "en-US",
        name: "English",
        file: "en.json",
      },
      {
        code: "de",
        iso: "de-DE",
        name: "Deutsch",
        file: "de.json",
      },
    ],
    pages: {
      poetry: {
        en: "/poetry",
        de: "/poesie",
      },
      reports: {
        en: "/reports",
        de: "/berichte",
      },
    },
    strategy: "prefix_and_default",
    defaultLocale: "en",
    vueI18n: {
      baseUrl: "https://eglador.de",
      fallbackLocale: "en",
      silentFallbackWarn: true,
    },
    detectBrowserLanguage: {
      useCookie: true,
      cookieKey: "lang",
      redirectOn: "root",
      alwaysRedirect: true,
    },
    vueI18nLoader: true,
    langDir: "~/locales/",
  },

It seems to me that the sitemap module is slightly confused by the structured locales property. It generates something like this:

    <url>
        <loc>https://mydomain.de/</loc>
        <lastmod>2022-08-07T17:25:50.816Z</lastmod>
        <changefreq>weekly</changefreq>
        <priority>1.0</priority>
        <xhtml:link rel="alternate" hreflang="de" href="https://mydomain.de/de" />
        <xhtml:link rel="alternate" hreflang="en" href="https://mydomain.de/en" />
        <xhtml:link rel="alternate" hreflang="x-default" href="https://mydomain.de/" />
    </url>

It states three alternative xhtml:link elements. Instead it should state only the en locale as a default without the non existing /en/* pathes and the de locale as an alternative to this with the /de/* pathes. Please make that these default options are supported, such that I can start to use your module again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions