Creation:2026-01-21Last update:2026-01-21
Reference this doc to your favorite AI assistantChatGPTClaudeDeepSeekGoogle AI modeGeminiPerplexityMistralGrok
Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
Version History
- "Initial documentation"v8.0.021/01/2026
The content of this page was translated using an AI.
See the last version of the original content in EnglishEdit this doc
If 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
Copy doc Markdown to clipboard
intlayer Express Middleware Documentation
The intlayer middleware for Express detects the user's locale and provides translation functions via the res.locals object. It also enables the use of the t and getIntlayer functions throughout your request handlers.
Usage
Description
The middleware performs the following tasks:
- Locale Detection: It checks cookies, headers (such as
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.