Multi-Language Subscription Preferences Page

MFischer
Participant | Platinum Partner

Hi there,

 

I am currently trying to create a multilingual Subscription Preferences Page.

We already have set up all the translations for email subscription types like shown here: https://knowledge.hubspot.com/contacts/create-translations-for-your-email-subscription-types

 

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.

 

URL: https://hs-9311353.s.hubspotemail.net/hs/manage-preferences/unsubscribe-test?languagePreference=fr&d...

 

request.query result: portalId=9311353&email=fischer%40nextage.ch

 

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 ?";

 

It would be super if someone could help me here!

0 Upvotes
4 Replies 4
dennisedson
Community Manager

@Anton , @Teun 

Have either of you worked with this issue before?

Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
0 Upvotes
Anton
Key Advisor | Diamond Partner

Hi @MFischer

the language is set in the crm right?

If so you could set it up like this. In this example I'll give the crm property the name "language". 

currentLangPref = "?contact.language?";

 

best, 

Anton




check
Did my post help answer your query? Help the Community by marking it as a solution



MFischer
Participant | Platinum Partner

Hi @Anton 

 

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.

 

Thanks anyway,
Michèle

0 Upvotes
Teun
Guide | Diamond Partner

I have not sadly! I do know that system pages do not return all the page variables that normal pages have available. Same goes for request.query..



Did my answer solve your issue? Help the community by marking it as the solution.