Skip to content

Default language not working as expected #89

Description

@AnderUstarroz

Summary of the issue

Default language not working as expected. Default language is set to Spanish (es), but the root page gets redirected to English (en)

Expected behavior

✅ When visiting the index page http://mysite.com/ it should load the page normally using the default language Spanish (es)

Current behavior

❗ When visiting the index page http://mysite.com/ it gets automatically redirected to http://mysite.com/en/

Setup details

The allowed languages for the site are:

  • English (en)
  • French (fr)
  • Spanish (es)

Version used:

    "gatsby": "^3.10.1"
    "i18next": "^20.4.0"
    "react-i18next": "^11.11.4"
    "gatsby-plugin-react-i18next": "^1.1.1"

Gatsby configuration:

{
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `${__dirname}/locales`,
        name: `locale`,
      },
    },
    {
      resolve: `gatsby-plugin-react-i18next`,
      options: {
        localeJsonSourceName: `locale`,
        defaultLanguage: "es",
        languages: ["es", "fr", "en"],
        siteUrl: `http://mysite.com/`,
        i18nextOptions: {
          interpolation: {
            escapeValue: false,
          },
          keySeparator: false,
          nsSeparator: false,
        },
      },
    },
    
...
...
}    

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions