Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
Version History
- "Unified documentation for all exports"v9.4.024/08/2026
The content of this page was translated using an AI.
See the last version of the original content in EnglishIf 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 doc Markdown to clipboard
elysia-intlayer Package
The elysia-intlayer package provides a plugin for Elysia applications to handle internationalisation. It detects the user's locale and injects an intlayer object into the route context.
Installation
Copy the code to the clipboard
Exports
Plugin
Import:
Copy the code to the clipboard
Open the table in a modal to view all data content clearly
| Function | Description | Related documentation |
|---|---|---|
intlayer | Elysia plugin that integrates Intlayer into your Elysia application. Handles locale detection from storage (cookies, headers) then from Accept-Language, injects an intlayer object exposing locale, t, getIntlayer and getDictionary into the route context, and sets up the AsyncLocalStorage request context. | intlayer |
Functions
Import:
Copy the code to the clipboard
Open the table in a modal to view all data content clearly
| Function | Description | Related documentation |
|---|---|---|
t | Global translation function that retrieves content for the current locale in Elysia. Uses AsyncLocalStorage to access the request context set up by the intlayer plugin, and falls back to the default locale outside of it. Can also be accessed via intlayer.t. | translation |
getIntlayer | Retrieves a dictionary by its key from the generated declaration and returns its content for the current locale. Optimised version of getDictionary. Uses AsyncLocalStorage to access the request context. Can also be accessed via intlayer.getIntlayer. | - |
getDictionary | Processes dictionary objects and returns content for the current locale. Processes t() translations, enumerations, markdown, HTML, etc. Uses AsyncLocalStorage to access the request context. Can also be accessed via intlayer.getDictionary. | - |
Types
Import:
Copy the code to the clipboard
Open the table in a modal to view all data content clearly
| Type | Description |
|---|---|
IntlayerContext | Shape of the intlayer object injected into every route context: locale, locale_storage, locale_detected, defaultLocale, t, getIntlayer, getDictionary. |
TranslateFunction | Signature of the translation function, translating a locale map into the content matching the current request locale. |
