diff --git a/Service/Generator.php b/Service/Generator.php index 02da71d..440bea0 100644 --- a/Service/Generator.php +++ b/Service/Generator.php @@ -23,10 +23,10 @@ class Generator public function __construct($menu_data, TranslatorInterface $trans) { + $this->translator = $trans; $this->index = new Collection(); $this->menu = new Collection(); $this->menu_data = $this->processConfigs($menu_data); - $this->translator = $trans; } public function getMenu($menu_key) @@ -137,9 +137,9 @@ class Generator $all_terms = $matches[1]; foreach ($all_terms as $term) { - if ($term == null) - continue; - $final_text = str_replace('[' . $term . ']', $this->translator->trans($term), $final_text); + $trans_term = ucwords($this->translator->trans($term)); + + $final_text = str_replace('[' . $term . ']', $trans_term, $final_text); } return $final_text; @@ -147,11 +147,9 @@ class Generator protected function newItem($index, $id, $label, $icon = null) { - $trans_label = $this->translate($label); - $mi = new Item(); $mi->setID($id) - ->setLabel($label) + ->setLabel($this->translate($label)) ->setRoute($id); if ($icon != null)