Blog - by Magnus Arebalus

    Multi-Language Menu Helix3 HelixUltimate JoomShaper

    Multi-Language Menu for Helix3 & HelixUtimate

    While implementing a multi-language Joomla!® website, having a different menu for each language is as easy as set every language menu module to the same position and they will be shown/hiden as required depending on the current language of the site and the language each module/menu is asigned to.

    Despite the above, JoomShaper Helix3 and JoomShaper Helix Ultimate can't be approached on that way, because they do not use a module position to create their menus, but a direct reference to a menu. So, let's see how to solve this issue with both popular templates by JoomShaper.

    Not hacking

    If you're not confortable hacking code, then you should duplicate the template style for each language and set the language menu for each style.

    You can find out the full process to duplicate template styles on the Joomla documentation. So, I'll not talk deeper on this.

    Hacking

    If you're like me and think that somethimes it worths to make customizations of code to fit our websites requirements, then I'll explain how to make both, Helix3 and HelixUtimate, templates to automatically select the proper language menu to be shown in the website.

    At first, you certainy have a mainmenu menu which were created during Joomla installation. According to multi-language documentation, you should create too one alternative language menu for each language used in your website.

    Menus Names

    The first step is to rename those language specific menus to something like mainmenu-xx-xx, which is composed as follows:

    • mainmenu is the base of the menu that will be configured Helix3 or HelixUtimate to display
    • xx-xx is the language tag, use lowercase characters (i.e. en-gb for English, es-es for Spanish, fr-fr for French, and so on)

    Once done, your menus list should look like the ones in image:

     Multi-Language Menus

    Template Style Configuration

    Now, let's configure the template style. To do so:

    • Select "Extensions" >> "Templates" from the backend main menu,
    • Click over "shaper_helix3 - Default" or "shaper_helixultimate - Default" style, depending on the template you are using for your website.
    • For Helix Ultimate only, click over the "Template Options" button.
    • Select the "Menu" option from the top bar for Helix3 or the "Navigation" option from the side bar for Helix Ultimate.
    • Make you sure that "Main Menu" option is selected as shown in both images for each Helix version.
      Multi language Helix3
      Multi language Helix3
    • Finally, save the changes.

    The hack

    Before making any hacks to original files, it's advised to make backup copies of such files.

    The last step is to hack the template's menu feature file, which can be found at JOOMLA_ROOT/templates/shaper_helix[3 or ultimate]/features/menu.php

    In menu.php for both Helix versions you'll find a function named renderFeature, at the very start of such function, insert the corresponding code as shown below

    For Helix3

         if ($this->helix3->getParam('menu') == 'mainmenu');
            {
                JFactory::getApplication()->getTemplate(true)->params->set('menu', 'mainmenu-'.strtolower(JFactory::getLanguage()->getTag()));
            }

    For Helix Ultimate

         if ($this->params->get('menu') == 'mainmenu');
            {
                $this->params->set('menu','mainmenu-'.strtolower(JFactory::getLanguage()->getTag()));
            }

    Once you have saved your changes, you can check the frontend in order to see the menu changes accordingly with every language change.

    Final thoughts

    Unfortunately, I still have not found a permanent way to override this template files. So, as a hack to original files, this changes will be lost every time you update the template and you will have to hack the new files again.

    Was this helpful? Do you have any questions? Do you have a better way to do the same? Please comment below and don't forget to share in your prefered social network.

     

     

    © 2018 TriMapa.com. All Rights Reserved.
    Positive SSL