<?php
namespace App\Controller\Admin;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Translation\TranslatorInterface;
class LocaleController extends AbstractController
{
/**
* @Route("setlocale/{language}", name="setlocale")
*/
public function setLocaleAction(Request $request,$language = null)
{
if($language != null)
{
$request->getSession()->set('_locale', $language);
}
$url = $request->headers->get("referer");
return new RedirectResponse($url);
//return $this->redirectToRoute('index_page_home');
}
/**
* @Route("lang/{language}", name="setlocale_langauge")
*/
public function setLocaleLangAction(Request $request,$language = null)
{
if($language != null)
{
$request->getSession()->set('_locale', $language);
}
// $url = $request->headers->get("referer");
// return new RedirectResponse($url);
return $this->redirectToRoute('index_page_home');
}
}