Subscription Preferences Page Header and Footer Language Variants

Hi all,

I am trying to create language variants for the header and footer of my subscription preferences template (email_subscription_preferences_page). This template extends the base.html template, which contains global partials for the header and footer areas of the template. If I could set different language variants of my subscription preferences page I could set language variants via the global content editor, but as I can’t set language variants for this system page (that I know of) is there another way to detect browser language in HubL and perhaps load different translated partial templates based on that language?
Thank you in advance!

Hi @MatthewShepherd,

I’ve did something like this a while ago:

{% if content.language.languageTag == "en" %}
english navigation
{% elif content.language.languageTag == "de" %}
german navigation
...
{% endif %}

Maybe it helps

best,

Anton

Thanks for your help @Anton
This variable helps me check the language settings of the page, but as the subscription preferences page is a system page, and I can’t use multiple different pages with different language settings for that page, this won’t work in this case. I think I need a similar if statement that checks the user’s browser language.

I believe I have found my solution with the following

 {% set lang = request.headers['accept-language']|split(',') %}
 {% set pblang = lang[0] %} 
 {% if pblang == "cs" %}
 {% global_partial path="../partials/footer_cs.html" %}
 {% elif pblang == "de" %}
 {% global_partial path="../partials/footer_de.html" %} 
 {% else %}
 {% global_partial path="../partials/footer.html" %}
 {% endif %}

using this code throughout my template I can pull in different partial templates that match the user’s primary browser language.