Skip to content
Snippets Groups Projects
Commit 947172ed authored by Fabrice Gangler's avatar Fabrice Gangler :art:
Browse files

fix: remove harcoded lang parameter

parent bd09448c
No related branches found
No related tags found
No related merge requests found
Pipeline #78539 failed
<?php
/*
* This file is part of the Tajine software.
* This file is part of the Comptoir-du-Libre software.
* <https://gitlab.adullact.net/Comptoir/comptoir-du-libre>
*
* Copyright (c) ADULLACT <https://adullact.org>
......@@ -25,6 +25,7 @@
use Symfony\Bridge\Twig\Attribute\Template;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
use Symfony\Component\Mailer\MailerInterface;
......@@ -83,15 +84,19 @@ public function checkSendingEmail(MailerInterface $mailer): Response
name: 'app_home',
methods: ['GET', 'HEAD']
)]
public function homePage(): RedirectResponse
public function homePage(Request $request): RedirectResponse
{
// dump($this->getParameter('app.i18n.default_locale'));
// dump($request->getLocale());
// dump($request->getDefaultLocale());
$lang = $request->getLocale();
$softwareName = $this->getParameter('app.software.name');
$slugSoftwareName = strtolower((new AsciiSlugger())->slug("$softwareName")->toString()) ;
$headers = [
"x-$slugSoftwareName-webapp" => true,
];
return new RedirectResponse(
url: $this->generateUrl(route: 'app_home_i18n', parameters: ['lang' => 'fr'],),
url: $this->generateUrl(route: 'app_home_i18n', parameters: ['lang' => "$lang"],),
status: Response::HTTP_PERMANENTLY_REDIRECT,
headers: $headers,
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment