<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class MainController extends AbstractController
{
#[Route('/change-locale/{locale}', name: 'change_locale')]
public function ChangeLocale($locale, Request $request): Response
{
$request->getSession()->set('_locale', $locale);
return $this->redirect($request->headers->get('referer'));
}
}