Skip to content

Commit

Permalink
Front end menu items translated in error (#19802)
Browse files Browse the repository at this point in the history
* Front end menu items translated in error

PR #13606 introduced translatable admin menu item creation but the code didnt check if the menu item was for the frontend or the admin before doing the translation

### Test Instructions
1. Install any additional language eg italian
2. Create a menu item called "Sun"
3. On the list of all the menu items you will see it is displayed as "Dom" - the italian translation
4. Enable language debug
5. On the list of all the menu items you will see all your menu item titles are surrounded by ?? - to indicate no translation found -  except for "Dom" which has ** instead to show it has been translated
6. Apply this PR
7. Sun still says Sun
8. There are NO ?? or ** when in language debug mode
9. Bonus - check a custom admin menu item and you will see it can be translated

* code style

* cs
  • Loading branch information
brianteeman authored and Michael Babker committed Mar 17, 2018
1 parent 2cc09f5 commit 5da070d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion administrator/components/com_menus/models/items.php
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ public function getItems()
{
$items = parent::getItems();
$lang = JFactory::getLanguage();
$client = $this->state->get('filter.client_id');

if ($items)
{
Expand All @@ -531,7 +532,10 @@ public function getItems()
}

// Translate component name
$item->title = JText::_($item->title);
if ($client === 1)
{
$item->title = JText::_($item->title);
}
}
}

Expand Down

0 comments on commit 5da070d

Please sign in to comment.