add translations
This commit is contained in:
parent
5769b29b69
commit
bc48a727a6
|
@ -11,6 +11,7 @@ use App\Core\Factory\Site\NodeFactory;
|
||||||
use App\Core\Manager\EntityManager;
|
use App\Core\Manager\EntityManager;
|
||||||
use App\Core\Repository\Site\NodeRepository;
|
use App\Core\Repository\Site\NodeRepository;
|
||||||
use App\Core\Slugify\CodeSlugify;
|
use App\Core\Slugify\CodeSlugify;
|
||||||
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class MenuEventSubscriber.
|
* class MenuEventSubscriber.
|
||||||
|
@ -24,19 +25,22 @@ class MenuEventSubscriber extends EntityManagerEventSubscriber
|
||||||
protected EntityManager $entityManager;
|
protected EntityManager $entityManager;
|
||||||
protected CodeSlugify $slugify;
|
protected CodeSlugify $slugify;
|
||||||
protected SymfonyCacheManager $cacheManager;
|
protected SymfonyCacheManager $cacheManager;
|
||||||
|
protected TranslatorInterface $translation;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
NodeFactory $nodeFactory,
|
NodeFactory $nodeFactory,
|
||||||
NodeRepository $nodeRepository,
|
NodeRepository $nodeRepository,
|
||||||
EntityManager $entityManager,
|
EntityManager $entityManager,
|
||||||
CodeSlugify $slugify,
|
CodeSlugify $slugify,
|
||||||
SymfonyCacheManager $cacheManager
|
SymfonyCacheManager $cacheManager,
|
||||||
|
TranslatorInterface $translator
|
||||||
) {
|
) {
|
||||||
$this->nodeFactory = $nodeFactory;
|
$this->nodeFactory = $nodeFactory;
|
||||||
$this->nodeRepository = $nodeRepository;
|
$this->nodeRepository = $nodeRepository;
|
||||||
$this->entityManager = $entityManager;
|
$this->entityManager = $entityManager;
|
||||||
$this->slugify = $slugify;
|
$this->slugify = $slugify;
|
||||||
$this->cacheManager = $cacheManager;
|
$this->cacheManager = $cacheManager;
|
||||||
|
$this->translator = $translator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function support(EntityInterface $entity)
|
public function support(EntityInterface $entity)
|
||||||
|
@ -75,7 +79,7 @@ class MenuEventSubscriber extends EntityManagerEventSubscriber
|
||||||
$childNode = $this->nodeFactory->create($menu, '/');
|
$childNode = $this->nodeFactory->create($menu, '/');
|
||||||
$childNode
|
$childNode
|
||||||
->setParent($rootNode)
|
->setParent($rootNode)
|
||||||
->setLabel('Premier élément')
|
->setLabel($this->translator->trans('First element'))
|
||||||
;
|
;
|
||||||
|
|
||||||
$menu->setRootNode($rootNode);
|
$menu->setRootNode($rootNode);
|
||||||
|
|
|
@ -213,3 +213,4 @@
|
||||||
"Enable": "Activer"
|
"Enable": "Activer"
|
||||||
"Disable": "Désactiver"
|
"Disable": "Désactiver"
|
||||||
"Reuse the query string": "Réutiliser la chaîne de requête"
|
"Reuse the query string": "Réutiliser la chaîne de requête"
|
||||||
|
"First element": "Premier élément"
|
||||||
|
|
Loading…
Reference in a new issue