5

I had to change the text on an Administrator menu item, and found that some of the menu items yse the title, others use the alias. One used a language string in the title column, and it works, but when I tried, it did not.

Could someone explain how the administrator menu considers these two columns, and where the Language string should exist. I tried the obvious places, but no luck - is there a naming convention?

2

The admin menu is an administrator module. It uses language constants for its menu items. To see what language constants it uses for each of its menu items, you can check the module's code in the module's template folder /administrator/modules/mod_menu/tmpl/

For example you will see CONSTANTS like :

MOD_MENU_CONFIGURATION
MOD_MENU_CONTROL_PANEL
MOD_MENU_CLEAR_CACHE
MOD_MENU_COM_USERS_USERS

You can create a language override for the administrator like below: E.g. for English, create a file named:

en-GB.override.ini

Add it in the language overrides folder for the administrator:

/administrator/language/overrides

Now you can place your overrides as desired in this file, e.g.:

MOD_MENU_CONFIGURATION="Settings"

This will override the title for the Global Configuration menu item from "Global Configuration" to "Settings".

Regarding the Components Menu Items: You need to check in the administrator your language's folder sys.ini language files for the component you would like to create the override. To find its Constant. E.g. for the Contacts Component (com_contact), check in the en-GB.com_contact.sys.ini, you will see its CONSTANT: COM_CONTACT="Contacts".

You can then use its CONSTANT in your language override file you created earlier and give your desired name.

Update 1

As an alternative approach, you can use an Extension to create your custom Admin Menu with your custom links. I use a lot the Admin Menu Manager (Free and Paid download) by Pages and Items.

Update 2

To fully understand how the admin menu works with the Components Menu, you should also study the getComponents function inside the module's helper file. There you can see that it checks for a few conditions in order to create the final Components SubMenu list.

Part of the code of the helper file (~ line 250):

if (!empty($component->element))
{
    // Load the core file then
    // Load extension-local file.
    $lang->load($component->element . '.sys', JPATH_BASE, null, false, true)
||  $lang->load($component->element . '.sys', JPATH_ADMINISTRATOR . '/components/' . $component->element, null, false, true);
}

$component->text = $lang->hasKey($component->title) ? JText::_($component->title) : $component->alias;

Hope this helps.

  • So if I understand correctly, to use a language constant in the admin menu, it must exist in the en-GB.com_XXX.sys.ini file, is that right? (presumably leaving en-GB.com_XXX.ini for com_XXX to use). Also, I appreciate all the module and extension advice, but I'm really only trying to figure out the "rules" of the core admin menu. – Al Knight Jul 23 '14 at 16:17
  • For the Components submenu you can check the helper file - see updated answer. – FFrewin Jul 23 '14 at 16:32
  • If you just want to override the menu text, using the language manager to create an override would probably be easier than uploading an override INI for each component sys.ini – Mathew Lenning Jul 25 '14 at 3:01
  • @MathewLenning, you only need 1 ini file for each language to make the override, not one ini for each component sys.ini. – FFrewin Sep 15 '14 at 16:28
  • @FFrewin sorry that my comment was a little misleading. I meant a INI which had overrides for the keys in each component.sys.ini, I didn't mean one file for each file, but I can see how ambiguous the comment was. Thanks for setting the record straight. – Mathew Lenning Sep 16 '14 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.