Hi everybody!
I have a small (I hope!) problem.
I’m working on a blog that is becoming multilangual and I need to add the HubSpot’s language switcher.
I’ve already used it in the past so I’m used to it.
The problem is that in this peculiar case, the header is a module, so if i try to insert another module inside it, an error appears.
Can you suggest me the fastest workaround to this problem?
Do I have to recreate the header like an HTML file or is there another way?
Thank a lot for your help!
@EricaFontimedia the language switcher doesn’t have to be it’s own module, you can add the code needed directly to the existing header module.
This would require a developer, I recommend reaching out in the HubSpot Developer Slack jobs channel if you don’t have someone on your team proficient with hubL.
Hi Jennifer,
I have the code and it is a module:
<div class="language-switcher">
<div class="header__language-switcher--label">
{% module 'language-switcher' path='@hubspot/language_switcher',
label='Language switcher',
display_mode='localized'
%}
<div class="header__language-switcher--label-current"> {{ locale_name(locale) }}</div>
</div>
</div>
Hi everybody, is there somebody that could help me to solve this problem?
Thanks again!
Hi @EricaFontimedia here’s what you’ll need to do:
1 - rebuild the header as a global partial
2 - create a module for the nav
3 - use the default ls(@hubspot /language-switcher