מחבר:
הפנו את עוזר ה-AI המועדף עליכם למסמך הזהChatGPTClaudeDeepSeekGoogle AI modeGeminiPerplexityMistralGrok
שאלו את שאלתכם וקבלו סיכום של המסמך על ידי הפניה לדף הזה ולספק ה-AI שתבחרו
היסטוריית גרסאות
- "Init doc"v8.0.021.1.2026
התוכן של הדף הזה תורגם באמצעות AI.
צפייה בגרסה האחרונה של התוכן המקורי באנגליתעריכת המסמך הזה
אם יש לכם רעיון לשיפור התיעוד הזה, אל תהססו לתרום על ידי הגשת Pull Request ב-GitHub.
קישור GitHub לתיעודנוצר:2026-01-21עדכון אחרון:2026-09-27
העתקה
העתקת ה-Markdown של המסמך ללוח
intlayer Express Middleware Documentation
The intlayer middleware for Express detects the user's locale and provides translation functions through the res.locals object. It also enables the use of the t and getIntlayer functions throughout your request handlers.
Usage
ts
העתקת קוד
העתקת הקוד ללוח
Description
The middleware performs the following tasks:
- Locale Detection: It checks cookies, headers (like
Accept-Language), and URL parameters to determine the user's locale. - Context Setup: it populates
res.localswith:locale: The detected locale.t: A translation function bound to the detected locale.getIntlayer: A function to retrieve dictionaries bound to the detected locale.
- Async Local Storage: it sets up a context that allows the use of global
tandgetIntlayerfunctions imported fromexpress-intlayerwithin the request flow.
