After we did that, we see a dropdown menu at the top of the email preferences page to select a translation language.
The page URL has a parameter "languagePreference" which contains the language code. This language, if available, is also selected directly in the DropDown.
Now I want to display further content based on this language. To do this, however, I need to be able to read out the parameter value.
The Hubl variable request.query does not return the given url, so no languagePreference parameter available. If I do that with javascript location.search I get the right URL containing the parameter languagePreference. But since I can't use Javasript variables in Hubl, I need to find the right Hubl variable to retriev the languagePreference value.
In the page source code I see a javascript function replaceLangPrefWith handels the language dropdown. I need to know which Hubl variable is used to set the default language: var currentLangPref = "? HUBL VARIABLE ?";
Hey @JaroB, You can inspect the element while previewing the pref-center to get the right class and hide it and adding some CSS to your main CSS file or the template specific one(if you're using one)like
first of all, I'm glad that you're trying to help me, and I appreciate it. I've copied the command you provided everywhere I could, but I still see the language switcher on the page. Please take a look at the screenshots.
Maybe I'm doing something wrong; I hope you can advise me.
Sep 13, 20238:41 AM - edited Sep 13, 20239:44 AM
Contributor | Elite Partner
Multi-Language Subscription Preferences Page
SOLVE
Hi @MFischer ! I have similar problem to solve, and I am rally quriouse how would you change the lang for further content in hubl that you cannot do in JS?
Do you mean to change the contact's preferred lang right? (that is hs_language).
The language of each contact is set within the crm: contact.hs_language. This value I get easily.
But the languagePreference parameter is set by the language of the email.
Now, it is theoretically possible for a French speaker to receive an English newsletter. Not nice but possible.
The dropdown and thus the subscriptions are displayed in the language of the newsletter. But since I can't query this language, the rest of the page would be in French (contact.hs_language). Also, I don't see any way to change the default language of the dropdown without refreshing the page.
It would be easiest if I could display the entire content of the page in the language from the languagePreference parameter. But for that I have to be able to read this parameter first.
The url parameter languagePreference desides in which language the subscription types are displayed. This parameter is set by the language of the email.
I tried to use a smartrule based of Preferred language which is based on the browser language. That works but mixes languages for example if the user recieved the emai in german but has browser set to englisch. -> no solution for me
Next I tried to use Query parameter as smart rule. But that didn't work as well because the parameter languagePreference is not available.
I don't understand why HubSpot doesn't finally offer a solution here. Multilingualism is not important in the USA at best, but it is very important for Europe, for example.