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.5.519/09/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
remix-intlayer Package
The remix-intlayer package provides the necessary tools to integrate Intlayer into Remix 3 applications. Built entirely on web standards (Request, Response, Headers, and URL), it offers a router middleware for locale-based routing and internal rewrites, context storage, hooks, and formatting utilities for seamless multilingual content management.
Installation
Copy the code to the clipboard
Exports
Middleware
Import:
Copy the code to the clipboard
Open the table in a modal to view all data content clearly
| Function | Description | Related Doc |
|---|---|---|
intlayer | Remix 3 router middleware that handles locale-based routing (redirects and internal rewrites), resolves the request locale, persists it in cookies/headers, and establishes the request context scope. | intlayer |
Context
Import:
Copy the code to the clipboard
Open the table in a modal to view all data content clearly
| Export | Type | Description | Related Doc |
|---|---|---|---|
Intlayer | ContextKey | RequestContext key holding the IntlayerState (locale, defaultLocale, availableLocales) for the current request. | Intlayer |
INTLAYER_CONTEXT_PROPERTY | string | Property name ('intlayer') installed directly on the request context, allowing access via context.intlayer as well as context.get(Intlayer). | - |
Hooks
Import:
Copy the code to the clipboard
Open the table in a modal to view all data content clearly
| Hook | Description | Related Doc |
|---|---|---|
useIntlayer | Picks one dictionary by its key and returns its content for the locale of the request being handled. Automatically reads from the request context. | useIntlayer |
useDictionary | Transforms an imported dictionary object and returns its content for the current request locale. Supports selector overrides. | useDictionary |
useLocale | Returns the resolved locale of the current request, along with the configured defaultLocale and availableLocales. | useLocale |
Utilities
Import:
Copy the code to the clipboard
Open the table in a modal to view all data content clearly
| Function | Description | Related Doc |
|---|---|---|
createLocaleRouting | Pure function that computes locale routing decisions (redirect, rewrite, or pass) given a request, configuration, and options. | - |
getIntlayerState | Reads the current IntlayerState (locale, defaultLocale, availableLocales) from the AsyncLocalStorage request scope. | - |
Formatters (remix-intlayer/format)
Import:
Copy the code to the clipboard
Open the table in a modal to view all data content clearly
| Hook | Description |
|---|---|
useIntl | Returns an Intl instance bound to the request locale with caching and subscription capabilities. |
useDate | Returns a date formatting function pre-bound to the request locale (Intl.DateTimeFormat). |
useNumber | Returns a number formatting function pre-bound to the request locale (Intl.NumberFormat). |
useCurrency | Returns a currency formatting function pre-bound to the request locale. |
usePercentage | Returns a percentage formatting function pre-bound to the request locale. |
useRelativeTime | Returns a relative time formatting function pre-bound to the request locale (Intl.RelativeTimeFormat). |
useList | Returns a list formatting function pre-bound to the request locale (Intl.ListFormat). |
useUnit | Returns a unit formatting function pre-bound to the request locale. |
useCompact | Returns a compact number formatting function pre-bound to the request locale (e.g. 1.5K). |
HTML Utilities (remix-intlayer/html)
Import:
Copy the code to the clipboard
Open the table in a modal to view all data content clearly
| Export | Type | Description |
|---|---|---|
renderHTML | Function | Standalone utility function to render HTML nodes outside of UI. |
useHTML | Hook | Hook to get the HTML provider context and configuration. |
useHTMLRenderer | Hook | Hook to obtain a pre-configured HTML renderer function. |
Markdown Utilities (remix-intlayer/markdown)
Import:
Copy the code to the clipboard
Open the table in a modal to view all data content clearly
| Export | Type | Description |
|---|---|---|
compileMarkdown | Function | Compiles markdown strings into structured representation. |
renderMarkdown | Function | Renders markdown content into output nodes. |
parseMarkdown | Function | Parses raw markdown content into an AST. |
useMarkdown | Hook | Hook to get the markdown provider context. |
useMarkdownRenderer | Hook | Hook to obtain a pre-configured Markdown renderer function. |
Types
Import:
Copy the code to the clipboard
Open the table in a modal to view all data content clearly
| Type | Description |
|---|---|
IntlayerState | The state object holding locale, defaultLocale, and availableLocales stored in the Remix request context. |
IntlayerMiddlewareOptions | Configuration options passed to the intlayer() middleware. |
LocaleRoutingOptions | Options customising locale prefixing, detection, and redirects. |
LocaleRoutingAction | Discriminated union representing the routing decision: redirect, rewrite, or pass. |
LocaleRoutingRequest | Minimal request representation required by createLocaleRouting. |
UseLocaleResult | Return type of useLocale(), containing locale, defaultLocale, and availableLocales. |
