TSparkleLocaleMiddleware Class
Middleware component that performs locale negotiation based on the Accept-Language HTTP header.
Remarks
This middleware parses the Accept-Language header from incoming requests and determines the best matching locale. The selected locale is stored in the request context and can be retrieved using Context.Item<ILocale>. The middleware also sets the Content-Language response header to indicate the locale used for the response.
Syntax
Unit: Sparkle.Comp.LocaleMiddleware
TSparkleLocaleMiddleware = class(TSparkleMiddleware);
Properties
| Name | Description |
|---|---|
| DefaultLocale | The default locale to use when no Accept-Language header is present or no matching locale is found. |
Events
| Name | Description |
|---|---|
| OnAcceptLocale | Event fired for each locale candidate during negotiation. |
| OnGetDefaultLocale | Event fired to dynamically determine the default locale. |