Fr3nch13/CakePHP Utilities

LocaleSelectorMiddleware
in package
implements MiddlewareInterface

Sets the runtime default locale for the request based on the Accept-Language header. The default will only be set if it matches the list of passed valid locales.

Table of Contents

Interfaces

MiddlewareInterface
Participant in processing a server request and response.

Properties

$locales  : array<string|int, mixed>
List of valid locales for the request

Methods

__construct()  : mixed
Constructor.
process()  : ResponseInterface
Set locale based on request headers.

Properties

Methods

__construct()

Constructor.

public __construct([array<string|int, mixed> $locales = [] ]) : mixed
Parameters
$locales : array<string|int, mixed> = []

A list of accepted locales, or ['*'] to accept any locale header value.


        
On this page

Search results