Fix translator assignment ordering
This commit is contained in:
parent
7fa710b6d2
commit
a31587b62e
1 changed files with 5 additions and 7 deletions
|
|
@ -23,10 +23,10 @@ class Generator
|
||||||
|
|
||||||
public function __construct($menu_data, TranslatorInterface $trans)
|
public function __construct($menu_data, TranslatorInterface $trans)
|
||||||
{
|
{
|
||||||
|
$this->translator = $trans;
|
||||||
$this->index = new Collection();
|
$this->index = new Collection();
|
||||||
$this->menu = new Collection();
|
$this->menu = new Collection();
|
||||||
$this->menu_data = $this->processConfigs($menu_data);
|
$this->menu_data = $this->processConfigs($menu_data);
|
||||||
$this->translator = $trans;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMenu($menu_key)
|
public function getMenu($menu_key)
|
||||||
|
|
@ -137,9 +137,9 @@ class Generator
|
||||||
$all_terms = $matches[1];
|
$all_terms = $matches[1];
|
||||||
foreach ($all_terms as $term)
|
foreach ($all_terms as $term)
|
||||||
{
|
{
|
||||||
if ($term == null)
|
$trans_term = ucwords($this->translator->trans($term));
|
||||||
continue;
|
|
||||||
$final_text = str_replace('[' . $term . ']', $this->translator->trans($term), $final_text);
|
$final_text = str_replace('[' . $term . ']', $trans_term, $final_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $final_text;
|
return $final_text;
|
||||||
|
|
@ -147,11 +147,9 @@ class Generator
|
||||||
|
|
||||||
protected function newItem($index, $id, $label, $icon = null)
|
protected function newItem($index, $id, $label, $icon = null)
|
||||||
{
|
{
|
||||||
$trans_label = $this->translate($label);
|
|
||||||
|
|
||||||
$mi = new Item();
|
$mi = new Item();
|
||||||
$mi->setID($id)
|
$mi->setID($id)
|
||||||
->setLabel($label)
|
->setLabel($this->translate($label))
|
||||||
->setRoute($id);
|
->setRoute($id);
|
||||||
|
|
||||||
if ($icon != null)
|
if ($icon != null)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue