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.
Properties summary
-
$locales
protectedList of valid locales for the requestarray
Method Summary
- __construct() publicConstructor.
- __invoke() public
Method Detail
__construct()source public
__construct( array $locales [] )
Constructor.
Parameters
- array
$locales
optional [] A list of accepted locales, or ['*'] to accept any locale header value.
__invoke()source public
__invoke( Psr\Http\Message\ServerRequestInterface $request , Psr\Http\Message\ResponseInterface $response , callable $next )
Parameters
- Psr\Http\Message\ServerRequestInterface
$request
- The request.
- Psr\Http\Message\ResponseInterface
$response
- The response.
- callable
$next
- The next middleware to call.
Returns
Psr\Http\Message\ResponseInterfaceA response.
Properties detail
© 2005–2017 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/3.4/class-Cake.I18n.Middleware.LocaleSelectorMiddleware.html