Пример #1
0
 public function visitMenuItem(MenuItem $item)
 {
     $domain = $item->getExtra('translation_domain');
     $parameters = $item->getExtra('translation_parameters');
     if (false === $parameters) {
         return;
     } elseif (!is_array($parameters)) {
         $parameters = [];
     }
     $id = $item->getLabel();
     if (null !== ($number = $item->getExtra('translation_number'))) {
         $item->setLabel($this->translator->transChoice($id, $number, $parameters, $domain));
     } else {
         $item->setLabel($this->translator->trans($id, $parameters, $domain));
     }
 }