Translate - language specific header and footer

New Contributor

Hi, I need some tips regarding translation settings. 
The icon below is can be found on your Website Pages. It is used to clone a specific page to multiple languages.  For easier management. I will refer to this as the function.   




The need:

Our site currently has three languages (more languages will be added soon) and one of them has an additional link in the header (top - navigation) and extra content in the footer.  



Code example 



The problem: 
To use the function every page needs one Template. To solve the need the site currently uses 1 set of Templates for each language.  Making the page bodyinternationalin the Templates is no brainer. But how do convert the header and the footer

Does this even make any sense to you guys or do I need to rephrase?

Is this even possible? Or do I need to rethink the sites  structure?

3 Replies
Regular Contributor

Hi there,


I was looking into the same issue. Don't know if you were able to solve this already? 


The menu issue can be solved by using HUBL code:


{# If statements for sites using language code subdirectories #}
{% if (content.slug is string_startingwith "en/") or (content.slug =="en") %}
{% menu "my_menu" site_map_name='Menu EN', overrideable=False, root_type='site_root', flyouts='true', max_levels='2', flow='horizontal', label='Advanced Menu' %}
{% else %}

{% menu "my_menu" site_map_name='Menu Base', overrideable=False, root_type='site_root', flyouts='true', max_levels='2', flow='horizontal', label='Advanced Menu' %}
{% endif %}


With this, you can generate the language specific contents. 




New Contributor

Hi, is it possible to set site_map_name param from a variable instead of performing the if/else statements? Something like:


site_map_name=requiredMenu, where requiredMenu us a string variable? I get the default menu with the code blellow


{% set requiredMenu = 'Required Menu Tree' %}
{menu "my_menu" site_map_name=requiredMenu}
{menu "my_menu" site_map_name="" ~ requiredMenu}
{menu "my_menu" site_map_name="" ~ requiredMenu ~ ""}
{menu "my_menu" site_map_name=["", requiredMenu]|join}
Top Contributor



You can try this  simple script


//get the language from <html>//

var lang=$("html").attr("lang");

// Hide the headers anf footers form the template  // 

.topHeaderMenu {
display: none;
.FooterMenu {
display: none;