שאלו את שאלתכם וקבלו סיכום של המסמך על ידי הפניה לדף הזה ולספק ה-AI שתבחרו
היסטוריית גרסאות
- "Rename intlayerMiddleware to intlayerProxy"v8.1.725.2.2026
- "Init doc"v8.0.021.1.2026
התוכן של הדף הזה תורגם באמצעות AI.
צפייה בגרסה האחרונה של התוכן המקורי באנגליתאם יש לכם רעיון לשיפור התיעוד הזה, אל תהססו לתרום על ידי הגשת Pull Request ב-GitHub.
קישור GitHub לתיעודהעתקת ה-Markdown של המסמך ללוח
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 localized 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 localized 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.
