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
- "Initialised 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 Fastify Plugin Documentation
The intlayer plugin for Fastify detects the user's locale and decorates the request object with Intlayer functions. It also enables the use of global translation functions within the request context.
Usage
Description
The plugin performs the following tasks:
- Locale Detection: It analyses the request (headers, cookies, etc.) to determine the user's preferred locale.
- Request Decoration: It adds an
intlayerproperty to theFastifyRequestobject, containing:locale: The detected locale.t: A translation function.getIntlayer: A function to retrieve dictionaries.
- Context Management: It uses
cls-hookedto manage an asynchronous context, allowing global Intlayer functions to access the request-specific locale.