Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[i18n] multiple locales in path #29075

Closed
AntoineBourin opened this issue Sep 14, 2021 · 2 comments
Closed

[i18n] multiple locales in path #29075

AntoineBourin opened this issue Sep 14, 2021 · 2 comments
Labels
bug Issue was opened via the bug report template.

Comments

@AntoineBourin
Copy link
Contributor

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.

@AntoineBourin AntoineBourin added the bug Issue was opened via the bug report template. label Sep 14, 2021
@ijjk ijjk closed this as completed Sep 21, 2021
@ijjk ijjk reopened this Sep 21, 2021
@ijjk
Copy link
Member

ijjk commented Sep 21, 2021

Closing as a duplicate of #20120

@ijjk ijjk closed this as completed Sep 21, 2021
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

3 participants