Author:
    Creation:2026-09-19Last update:2026-09-19

    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

    bash
    npm install remix-intlayer
    

    Exports

    Middleware

    Import:

    tsx
    import { intlayer } from "remix-intlayer";
    
    FunctionDescriptionRelated Doc
    intlayerRemix 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:

    tsx
    import { Intlayer, INTLAYER_CONTEXT_PROPERTY } from "remix-intlayer";
    
    ExportTypeDescriptionRelated Doc
    IntlayerContextKeyRequestContext key holding the IntlayerState (locale, defaultLocale, availableLocales) for the current request.Intlayer
    INTLAYER_CONTEXT_PROPERTYstringProperty name ('intlayer') installed directly on the request context, allowing access via context.intlayer as well as context.get(Intlayer).-

    Hooks

    Import:

    tsx
    import { useIntlayer, useDictionary, useLocale } from "remix-intlayer";
    
    HookDescriptionRelated Doc
    useIntlayerPicks one dictionary by its key and returns its content for the locale of the request being handled. Automatically reads from the request context / storage.useIntlayer
    useDictionaryTransforms an imported dictionary object and returns its content for the current request locale. Supports selector overrides.useDictionary
    useLocaleReturns the resolved locale of the current request, along with the configured defaultLocale and availableLocales.useLocale

    Utilities

    Import:

    tsx
    import { createLocaleRouting, getIntlayerState } from "remix-intlayer";
    
    FunctionDescriptionRelated Doc
    createLocaleRoutingPure function that computes locale routing decisions (redirect, rewrite, or pass) given a request, configuration, and options.-
    getIntlayerStateReads the current IntlayerState (locale, defaultLocale, availableLocales) from the AsyncLocalStorage request scope outside of React components.-

    Formatters (remix-intlayer/format)

    Import:

    tsx
    import {
      useIntl,
      useDate,
      useNumber,
      useCurrency,
      usePercentage,
      useRelativeTime,
      useList,
      useUnit,
      useCompact,
    } from "remix-intlayer/format";
    
    HookDescription
    useIntlReturns an Intl instance bound to the request locale with caching and subscription capabilities.
    useDateReturns a date formatting function pre-bound to the request locale (Intl.DateTimeFormat).
    useNumberReturns a number formatting function pre-bound to the request locale (Intl.NumberFormat).
    useCurrencyReturns a currency formatting function pre-bound to the request locale.
    usePercentageReturns a percentage formatting function pre-bound to the request locale.
    useRelativeTimeReturns a relative time formatting function pre-bound to the request locale (Intl.RelativeTimeFormat).
    useListReturns a list formatting function pre-bound to the request locale (Intl.ListFormat).
    useUnitReturns a unit formatting function pre-bound to the request locale.
    useCompactReturns a compact number formatting function pre-bound to the request locale (e.g. 1.5K).

    HTML Utilities (remix-intlayer/html)

    Import:

    tsx
    import { renderHTML, useHTML, useHTMLRenderer } from "remix-intlayer/html";
    
    ExportTypeDescription
    renderHTMLFunctionStandalone utility function to render HTML nodes outside of UI.
    useHTMLHookHook to get the HTML provider context and configuration.
    useHTMLRendererHookHook to obtain a pre-configured HTML renderer function.

    Markdown Utilities (remix-intlayer/markdown)

    Import:

    tsx
    import {
      compileMarkdown,
      renderMarkdown,
      parseMarkdown,
      useMarkdown,
      useMarkdownRenderer,
    } from "remix-intlayer/markdown";
    
    ExportTypeDescription
    compileMarkdownFunctionCompiles markdown strings into structured representation.
    renderMarkdownFunctionRenders markdown content into output nodes.
    parseMarkdownFunctionParses raw markdown content into an AST.
    useMarkdownHookHook to get the markdown provider context.
    useMarkdownRendererHookHook to obtain a pre-configured Markdown renderer function.

    Types

    Import:

    tsx
    import type {
      IntlayerState,
      IntlayerMiddlewareOptions,
      LocaleRoutingOptions,
      LocaleRoutingAction,
      LocaleRoutingRequest,
      UseLocaleResult,
    } from "remix-intlayer";
    
    TypeDescription
    IntlayerStateThe state object holding locale, defaultLocale, and availableLocales stored in the Remix request context.
    IntlayerMiddlewareOptionsConfiguration options passed to the intlayer() middleware.
    LocaleRoutingOptionsOptions customizing locale prefixing, detection, and redirects.
    LocaleRoutingActionDiscriminated union representing the routing decision: redirect, rewrite, or pass.
    LocaleRoutingRequestMinimal request representation required by createLocaleRouting.
    UseLocaleResultReturn type of useLocale(), containing locale, defaultLocale, and availableLocales.