CMS Development

MFischer
Participant | Partenaire solutions Platinum
Participant | Partenaire solutions Platinum

Multi-Language Subscription Preferences Page

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!

8 Réponses
lstepany
Contributeur | Partenaire solutions Elite
Contributeur | Partenaire solutions Elite

Multi-Language Subscription Preferences Page

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? 

lstepany_0-1694608809297.png

 

Do you mean to change the contact's preferred lang right? (that is hs_language).

 

0 Votes
Teun
Expert reconnu | Partenaire solutions Diamond
Expert reconnu | Partenaire solutions Diamond

Multi-Language Subscription Preferences Page

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..



Learn more about HubSpot by following me on LinkedIn or YouTube

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


dennisedson
Équipe de développement de HubSpot
Équipe de développement de HubSpot

Multi-Language Subscription Preferences Page

@Anton , @Teun 

Have either of you worked with this issue before?

0 Votes
Anton
Expert reconnu | Partenaire solutions Diamond
Expert reconnu | Partenaire solutions Diamond

Multi-Language Subscription Preferences Page

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

Anton Bujanowski Signature
MFischer
Participant | Partenaire solutions Platinum
Participant | Partenaire solutions Platinum

Multi-Language Subscription Preferences Page

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

fiberpunk
Contributeur

Multi-Language Subscription Preferences Page

Hi Michèle, 

 

Looks like I am in the same situation as you, were you ever able to resolve this?

 

Cheers,

Christoph

0 Votes
MFischer
Participant | Partenaire solutions Platinum
Participant | Partenaire solutions Platinum

Multi-Language Subscription Preferences Page

Hi @fiberpunk 

 

Unfortunately no.
I have just tested the suggested solution here: https://community.hubspot.com/t5/HubSpot-Ideas/Multi-language-support-for-email-subscription-pages/i...

 

That doesn't work as well.

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.

0 Votes
fiberpunk
Contributeur

Multi-Language Subscription Preferences Page

Thanks anyway @MFischer! Here´s hoping that somedays there will be a working/clean solution for this ...