Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
Version History
- "Rename intlayerMiddleware to intlayerProxy"v8.1.725/02/2026
- "Initialised doc"v8.0.021/01/2026
The content of this page was translated using an AI.
See the last version of the original content in EnglishIf you have an idea for improving this documentation, please feel free to contribute by submitting a pull request on GitHub.
GitHub link to the documentationCopy doc Markdown to clipboard
intlayerProxy (intlayerMiddleware) Documentation
The intlayerProxy (intlayerMiddleware for nextjs < 16) function is a Next.js middleware that handles locale-based routing and redirects. It automatically detects the user's preferred locale and redirects them to the appropriate localised path if necessary.
Usage
Description
The middleware performs the following tasks:
- Locale Detection: It checks the URL path, cookies, and
Accept-Languageheader to determine the user's locale. - Redirection: If the URL does not contain a locale prefix and the configuration requires one (or based on the user's preferences), it redirects to the localised URL.
- Cookie Management: It can store the detected locale in a cookie for future requests.
Parameters
The function takes the standard Next.js NextRequest as a parameter when used directly, or it can be exported as shown above.
Configuration
To configure the middleware, you can set up the routing option in the intlayer.config.ts file. See configuration for more details.