Skip to main content
zerotal

Documentation


Documentation / @zerotal/i18n / LocaleMiddleware

Class: LocaleMiddleware

Defined in: i18n/src/LocaleMiddleware.ts:13

Resolves the request locale, exposes ctx.locale + ctx.t(), and runs the rest of the pipeline inside I18nContext.run() so the Lang facade and the global t() helper see the right locale. Configured by I18nProvider via LocaleMiddleware.configure() and registered with app.useOnce().

Implements

Constructors

Constructor

new LocaleMiddleware(): LocaleMiddleware

Returns

LocaleMiddleware

Methods

configure()

static configure(translator, config): void

Defined in: i18n/src/LocaleMiddleware.ts:17

Parameters

translator

Translator

config

I18nConfigShape

Returns

void


handle()

handle(http, next): Promise<void | Response>

Defined in: i18n/src/LocaleMiddleware.ts:22

Parameters

http

HttpContext

next

NextFn

Returns

Promise<void | Response>

Implementation of

Pipe.handle