Class LocaleSelectorMiddleware
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.
Namespace: Cake\I18n\Middleware
Property Summary
-
$locales protected
array
List of valid locales for the request
Method Summary
-
__construct() public
Constructor.
-
__invoke() public
Method Detail
__construct() ¶ public
__construct(array $locales = [])
Constructor.
Parameters
-
array
$locales optional A list of accepted locales, or ['*'] to accept any locale header value.
__invoke() ¶ public
__invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next): Psr\Http\Message\ResponseInterface
Parameters
-
ServerRequestInterface
$request The request.
-
ResponseInterface
$response The response.
-
callable
$next The next middleware to call.
Returns
Psr\Http\Message\ResponseInterface