diff --git a/Menu/SectionMenuBuilder.php b/Menu/SectionMenuBuilder.php
index 9a4380144..ea6a1d060 100644
--- a/Menu/SectionMenuBuilder.php
+++ b/Menu/SectionMenuBuilder.php
@@ -1,4 +1,5 @@
*
@@ -15,36 +16,54 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
+
namespace Chill\PersonBundle\Menu;
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
+use Symfony\Component\Translation\TranslatorInterface;
/**
- *
+ * Class SectionMenuBuilder
*
+ * @package Chill\PersonBundle\Menu
* @author Julien Fastré
*/
class SectionMenuBuilder implements LocalMenuBuilderInterface
{
/**
- *
* @var AuthorizationCheckerInterface
*/
protected $authorizationChecker;
- public function __construct(AuthorizationCheckerInterface $authorizationChecker)
+ /**
+ * @var TranslatorInterface
+ */
+ protected $translator;
+
+ /**
+ * SectionMenuBuilder constructor.
+ *
+ * @param AuthorizationCheckerInterface $authorizationChecker
+ * @param TranslatorInterface $translator
+ */
+ public function __construct(AuthorizationCheckerInterface $authorizationChecker, TranslatorInterface $translator)
{
$this->authorizationChecker = $authorizationChecker;
+ $this->translator = $translator;
}
-
+ /**
+ * @param $menuId
+ * @param MenuItem $menu
+ * @param array $parameters
+ */
public function buildMenu($menuId, MenuItem $menu, array $parameters)
{
if ($this->authorizationChecker->isGranted(PersonVoter::CREATE)) {
- $menu->addChild('Add a person', [
+ $menu->addChild($this->translator->trans('Add a person'), [
'route' => 'chill_person_new'
])
->setExtras([
@@ -53,7 +72,10 @@ class SectionMenuBuilder implements LocalMenuBuilderInterface
]);
}
}
-
+
+ /**
+ * @return array
+ */
public static function getMenuIds(): array
{
return [ 'section' ];
diff --git a/Resources/config/services/menu.yml b/Resources/config/services/menu.yml
index 74e00ee67..c70851a84 100644
--- a/Resources/config/services/menu.yml
+++ b/Resources/config/services/menu.yml
@@ -2,6 +2,7 @@ services:
Chill\PersonBundle\Menu\SectionMenuBuilder:
arguments:
$authorizationChecker: '@Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface'
+ $translator: '@Symfony\Component\Translation\TranslatorInterface'
tags:
- { name: 'chill.menu_builder' }
diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml
index 2dee76dad..b2fe057f4 100644
--- a/Resources/translations/messages.fr.yml
+++ b/Resources/translations/messages.fr.yml
@@ -152,6 +152,7 @@ Back to the person details: Retour aux détails de la personne
Timeline: Historique
Closing the accompanying period: Fermeture de la période d'accompagnement
Opening the accompanying period: Ouverture d'une période d'accompagnement
+'Timeline for %name%': 'Historique de %name%'
#roles
CHILL_PERSON_SEE: Voir les personnes