From: Raphaƫl Gertz Date: Thu, 12 Aug 2021 15:12:23 +0000 (+0200) Subject: Cleanup locale X-Git-Tag: 0.2.0~103 X-Git-Url: https://git.rapsys.eu/airbundle/commitdiff_plain/15acb004e92efe2dd0bf8ff00a716595b536d6f2 Cleanup locale Fix facebook texts merging --- diff --git a/Controller/SessionController.php b/Controller/SessionController.php index 5a48d99..3ba3a88 100644 --- a/Controller/SessionController.php +++ b/Controller/SessionController.php @@ -43,8 +43,11 @@ class SessionController extends DefaultController { //Get doctrine $doctrine = $this->getDoctrine(); + //Set locale + $locale = $request->getLocale(); + //Fetch session - $session = $doctrine->getRepository(Session::class)->fetchOneById($id, $request->getLocale()); + $session = $doctrine->getRepository(Session::class)->fetchOneById($id, $locale); //Check if if ( @@ -107,16 +110,13 @@ class SessionController extends DefaultController { $this->context['page']['section'] = $this->translator->trans($session['l_title']); //Set localization date formater - $intlDate = new \IntlDateFormatter($this->locale, \IntlDateFormatter::TRADITIONAL, \IntlDateFormatter::NONE); + $intlDate = new \IntlDateFormatter($locale, \IntlDateFormatter::TRADITIONAL, \IntlDateFormatter::NONE); //Set localization time formater - $intlTime = new \IntlDateFormatter($this->locale, \IntlDateFormatter::NONE, \IntlDateFormatter::SHORT); + $intlTime = new \IntlDateFormatter($locale, \IntlDateFormatter::NONE, \IntlDateFormatter::SHORT); //Set facebook image - $this->facebookImage = [ - //XXX: was facebook///..jpeg - //XXX: format facebook..jpeg - #'destination' => 'facebook/session/view/'.$id.'.'.$locale.'.jpeg', + $this->context['facebook'] += [ 'texts' => [ $session['au_pseudonym'] => [ 'font' => 'irishgrover', @@ -603,8 +603,11 @@ class SessionController extends DefaultController { //Fetch doctrine $doctrine = $this->getDoctrine(); + //Set locale + $locale = $request->getLocale(); + //Fetch session - if (empty($session = $doctrine->getRepository(Session::class)->fetchOneById($id, $this->locale))) { + if (empty($session = $doctrine->getRepository(Session::class)->fetchOneById($id, $locale))) { throw $this->createNotFoundException($this->translator->trans('Unable to find session: %id%', ['%id%' => $id])); } @@ -643,7 +646,7 @@ class SessionController extends DefaultController { } //Set localization date formater - $intl = new \IntlDateFormatter($this->locale, \IntlDateFormatter::GREGORIAN, \IntlDateFormatter::SHORT); + $intl = new \IntlDateFormatter($locale, \IntlDateFormatter::GREGORIAN, \IntlDateFormatter::SHORT); //Set section $this->context['page']['section'] = $this->translator->trans($session['l_title']); @@ -658,16 +661,13 @@ class SessionController extends DefaultController { ]; //Set localization date formater - $intlDate = new \IntlDateFormatter($this->locale, \IntlDateFormatter::TRADITIONAL, \IntlDateFormatter::NONE); + $intlDate = new \IntlDateFormatter($locale, \IntlDateFormatter::TRADITIONAL, \IntlDateFormatter::NONE); //Set localization time formater - $intlTime = new \IntlDateFormatter($this->locale, \IntlDateFormatter::NONE, \IntlDateFormatter::SHORT); + $intlTime = new \IntlDateFormatter($locale, \IntlDateFormatter::NONE, \IntlDateFormatter::SHORT); //Set facebook image - $this->facebookImage = [ - //XXX: was facebook///..jpeg - //XXX: format facebook..jpeg - #'destination' => 'facebook/session/view/'.$id.'.'.$this->locale.'.jpeg', + $this->context['facebook'] = [ 'texts' => [ $session['au_pseudonym'] => [ 'font' => 'irishgrover', @@ -683,7 +683,7 @@ class SessionController extends DefaultController { ] ], 'updated' => $session['updated']->format('U') - ]; + ]+$this->context['facebook']; //With granted session if (!empty($session['au_id'])) {