Creation:2026-01-21Last update:2026-01-21

    express-intlayer Package

    The express-intlayer package provides a middleware for Express applications to handle internationalization. It detects the user's locale and provides translation functions.

    Installation

    npm install express-intlayer

    Exports

    Middleware

    Import:

    import "express-intlayer";
    Function Description Related Doc
    intlayer Express middleware that detects the user's locale and populates res.locals with Intlayer data. Performs locale detection from cookies/headers, injects t, getIntlayer, and getDictionary into res.locals, and sets up CLS namespace for request lifecycle access. intlayer

    Functions

    Import:

    import "express-intlayer";
    Function Description Related Doc
    t Translation function that retrieves content for the current locale. Works within the request lifecycle managed by the intlayer middleware. Uses CLS (Async Local Storage) to access request context. translation
    getIntlayer Retrieves a dictionary by its key from the generated declaration and returns its content for the specified locale. Optimized version of getDictionary. Uses CLS to access request context. -
    getDictionary Processes dictionary objects and returns content for the specified locale. Processes t() translations, enumerations, markdown, HTML, etc. Uses CLS to access request context. -