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.
array
List of valid locales for the request
Constructor.
Set locale based on request headers.
__construct(array $locales = [])
Constructor.
array
$locales optional A list of accepted locales, or ['*'] to accept any locale header value.
process(ServerRequestInterface $request, RequestHandlerInterface $handler): Psr\Http\Message\ResponseInterface
Set locale based on request headers.
Processes an incoming server request in order to produce a response. If unable to produce the response itself, it may delegate to the provided request handler to do so.
ServerRequestInterface
$request The request.
RequestHandlerInterface
$handler The request handler.
Psr\Http\Message\ResponseInterface
List of valid locales for the request
array
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.I18n.Middleware.LocaleSelectorMiddleware.html