Skip to content

[i18n] multiple locales in path #29075

Closed
Closed
@AntoineBourin

Description

@AntoineBourin

What version of Next.js are you using?

10.1.1

What version of Node.js are you using?

12.0.0

What browser are you using?

Chrome, Firefox

What operating system are you using?

macOS

How are you deploying your application?

next dev

Describe the Bug

I have a website with next i18n enabled on it.
The configuration of i18n translation is described like this :
i18n: { locales: ['fr-fr', 'fr-be', 'nl-be'], defaultLocale: 'fr-fr', },

Translation working as expected but we have a problem when multiple locales are defined in path.

For example, with i18n translation with the following configuration, we expected 404 error page to be triggered :
localhost:3000/fr-fr/fr-be
localhost:3000/fr-fr/nl-be
localhost:3000/fr-be/nl-be etc...

Expected Behavior

For these pages described above, the index page is triggered and the last locale wrote in path is selected.
localhost:3000/fr-fr/fr-be => display index instead of 404 page => select fr-be locale in context
localhost:3000/fr-be/nl-be => display index instead of 404 page => select nl-be locale in context

To Reproduce

Just create a nextJS project, add next-i18n and add some locales in the configuration file.
Create a simple index.js page in pages directory.

Try to access to your website with multiple locales in path. Instead of displaying 404 error page, your index page will be show.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions