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

Support for optional default locale #1

Closed
fabio-nettis opened this issue Aug 14, 2023 · 1 comment
Closed

Support for optional default locale #1

fabio-nettis opened this issue Aug 14, 2023 · 1 comment
Labels
awaiting-feature This suggestion requires a new feature in Next.js. enhancement New feature or request

Comments

@fabio-nettis
Copy link
Owner

fabio-nettis commented Aug 14, 2023

Describe the new feature

While this repository works perfectly fine when the locale is always defined, we need to add support for optional default locales so users can either visit /{default}/example-page or /example-page while both requests will result in the page being displayed in the default locale.

Suggested solution

We could utilize the optional route segment feature, but this does not support optional route parameters yet as we encounter the following error otherwise:

Error: Optional route parameters are not yet supported ("[[locale]]").
@fabio-nettis fabio-nettis added enhancement New feature or request awaiting-feature This suggestion requires a new feature in Next.js. labels Aug 14, 2023
@fabio-nettis fabio-nettis pinned this issue Aug 14, 2023
@fabio-nettis
Copy link
Owner Author

After further tinkering around with internationalization of Next.js 14 apps I can gladly say: You can indeed make the default locale optional using rewrites and middleware. If anybody is interested in the implementation just upvote this comment and ?l'll create a separate branch for it. 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-feature This suggestion requires a new feature in Next.js. enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant