Creation:2026-01-30Last update:2026-01-30
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.01/30/2026
Edit 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 AdonisJS Middleware Documentation
The intlayer middleware for AdonisJS detects the user's locale and provides translation functions through the request context. It also enables the use of global translation functions within the request flow.
Usage
Description
The middleware performs the following tasks:
- Locale Detection: It analyzes the request (headers, cookies, etc.) to determine the user's preferred locale.
- Context Setup: It populates the request context with locale information.
- Async Local Storage: It uses
cls-hookedto manage an asynchronous context, allowing global Intlayer functions liket,getIntlayer, andgetDictionaryto access the request-specific locale without passing it manually.
Note: To use cookies for locale detection, ensure @adonisjs/cookie is configured and used in your application.