Setu-TS
    Preparing search index...

    Function replaceLocale

    • Replaces request.locale deliberately, bypassing the single-write guard.

      The localization plugin's middleware calls it, for the reason replacePrincipal documents. An application calls it to apply a preference the middleware could not see — a signed-in user's saved locale once authentication has run. A response cache keys on the locale present when it runs, so call this before the cache lookup for the override to be reflected there. Safe to call on a request that was never sealed.

      Parameters

      • request: IRequest

        The request whose locale is being replaced

      • locale: string

        The BCP 47 tag to install — a supported locale, never raw client text

      Returns void

      // After authentication: apply the user's stored preference.
      replaceLocale(ctx.request, profile.locale);

      0.9.0