Skip to main content

locale

Function locale 

Source
pub async fn locale(req: Request, next: Next) -> Result<Response>
Expand description

Middleware: parse the inbound Accept-Language header and stash the negotiated locale in the request context. Falls back to DEFAULT_LOCALE when the header is absent or contains no valid tag. Never fails — locale negotiation is best-effort by design, and a missing or malformed header collapses to the default rather than rejecting the request.