Skip to content

Doesn't manage the default language at all if it is not ‘en’ #186

@kinooyume

Description

@kinooyume

Hi,

When I set the defaultLanguage to something else than en (I tried with fr and de), I got this behavior:

The Url is redirect to the en url. E.g:

  • example.com -> example.com/en
  • example.com/mail -> example.com/en/mail

When I try to "force" to the default language, I have a page error:

  • example.com/fr -> example.com/en/en/fr -> Not found
  • example.com/fr/mail -> example.com/en/en/fr/mail

Here is my gatsby-config.ts:

{
      resolve: `gatsby-plugin-react-i18next`,
      options: {
        localeJsonSourceName: `locale`, // name given to `gatsby-source-filesystem` plugin.
        languages: ['fr', 'en', 'de'],
        defaultLanguage: 'fr',
        fallbackLanguage: 'fr',
        siteUrl: `${siteUrl}`,
        // if you are using trailingSlash gatsby config include it here, as well (the default is 'always')
        trailingSlash: 'always',
        // you can pass any i18next options
        i18nextOptions: {
          interpolation: {
            escapeValue: false, // not needed for react as it escapes by default
          },
          lowerCaseLng: true,
          saveMissing: false,
          keySeparator: false,
          nsSeparator: false,
        },
      },
    }

If I set the defaultLanguage to en, it works as expected.

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