Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Add locales to NextURL for access in Middleware #37253

Closed
ambrauer opened this issue May 27, 2022 · 0 comments
Closed

Add locales to NextURL for access in Middleware #37253

ambrauer opened this issue May 27, 2022 · 0 comments

Comments

@ambrauer
Copy link

Describe the feature you'd like to request

The NextRequest nextUrl provides other locale info (locale, defaultLocale, domainLocale - which does include locales), but is notably missing locales. This is useful information to have particularly in middleware which is handling rewrites and redirects.

Describe the solution you'd like

Included the configured i18n locales under a locales prop on NextURL so that it is accessible on NextRequest in middleware. This would be in line with i18n config accessibility in other areas of the API.

Describe alternatives you've considered

Duplicating configured locales in middleware code, or storing locales in common file.

ambrauer added a commit to Sitecore/jss that referenced this issue May 27, 2022
…3) and use static values for now. next.config.js is not intended to be imported in this way. We should have access to locales directly in middleware in the future: vercel/next.js#37253
illiakovalenko pushed a commit to Sitecore/jss that referenced this issue May 30, 2022
…1045)

* Remove import of next.config.js in redirects middleware (fixes #535263) and use static values for now. next.config.js is not intended to be imported in this way. We should have access to locales directly in middleware in the future: vercel/next.js#37253

* Add type assist jsdoc for NextConfig
@vercel vercel locked and limited conversation to collaborators May 30, 2022
@timneutkens timneutkens converted this issue into discussion #37295 May 30, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant