1
0
mirror of https://gitnet.fr/deblan/gist.git synced 2021-08-14 08:30:49 +02:00

default locale

This commit is contained in:
Simon Vieille 2015-11-24 19:02:40 +01:00
parent ca4246d3af
commit a68da97952

View File

@ -63,8 +63,12 @@ $app->get('/', function (Request $request) use ($app) {
));
});
$app->after(function(Request $request, Response $response) use ($app) {
$value = $request->cookies->get('locale');
$app->after(function (Request $request, Response $response) use ($app) {
if ($response instanceof RedirectResponse) {
return;
}
$value = $request->get('_locale');
$cookie = new Cookie('locale', $value, strtotime('+1 month'));
$response->headers->setCookie($cookie);