CMS Development

MFischer
Participant | Platinum Partner
Participant | Platinum Partner

Multi-Language Subscription Preferences Page

SOLVE

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!

1 Accepted solution
Anton
Solution
Thought Leader | Partner
Thought Leader | Partner

Multi-Language Subscription Preferences Page

SOLVE

Hey @JaroB

here's the correct code to disable the language dropdown

 

form .localization-language{
display:none;
}

 

best, 

Anton

Anton Bujanowski Signature

View solution in original post

16 Replies 16
JaroB
Participant

Multi-Language Subscription Preferences Page

SOLVE

Hi everyone, I need to remove the language switcher from the preference page. Can anyone please advise on how to do that? Thank you.

0 Upvotes
Anton
Thought Leader | Partner
Thought Leader | Partner

Multi-Language Subscription Preferences Page

SOLVE

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 

 

select.CLASS-OF-TRANSLATIONS-DROPDOWN{
   display:none
}

 

 

best, 

Anton

Anton Bujanowski Signature
0 Upvotes
JaroB
Participant

Multi-Language Subscription Preferences Page

SOLVE

Hi @Anton  , 

I added the following CSS code:

<style>
select.language-switcher {
  display: none;
}
</style>

Unfortunately, the language switcher is still visible.

Any futher ideas? 🙂 

Jaro

0 Upvotes
lstepany
Contributor | Elite Partner
Contributor | Elite Partner

Multi-Language Subscription Preferences Page

SOLVE

<style> .language-switcher { display: none; } </style> 

0 Upvotes
JaroB
Participant

Multi-Language Subscription Preferences Page

SOLVE

Hi @lstepany ,

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.

Thank you,
Jaro

 

preferences page config - design modulepreferences page config - design modulepreferences page config - design modulepreferences page config - design moduleconfig sub module - design managerconfig sub module - design managerPreferences update pagePreferences update page

0 Upvotes
Anton
Solution
Thought Leader | Partner
Thought Leader | Partner

Multi-Language Subscription Preferences Page

SOLVE

Hey @JaroB

here's the correct code to disable the language dropdown

 

form .localization-language{
display:none;
}

 

best, 

Anton

Anton Bujanowski Signature
JaroB
Participant

Multi-Language Subscription Preferences Page

SOLVE

Hi @Anton ,

thnak you for advice, it works. 

Have a nice day,

Best regards

Jaro

0 Upvotes
lstepany
Contributor | Elite Partner
Contributor | Elite Partner

Multi-Language Subscription Preferences Page

SOLVE

@joro can you inspect and check in the browser what is the css selector of your lang switcher?

0 Upvotes
lstepany
Contributor | Elite Partner
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? 

lstepany_0-1694608809297.png

 

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

 

0 Upvotes
Teun
Recognized Expert | Elite Partner
Recognized Expert | Elite Partner

Multi-Language Subscription Preferences Page

SOLVE

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
HubSpot Product Team
HubSpot Product Team

Multi-Language Subscription Preferences Page

SOLVE

@Anton , @Teun 

Have either of you worked with this issue before?

0 Upvotes
Anton
Thought Leader | Partner
Thought Leader | Partner

Multi-Language Subscription Preferences Page

SOLVE

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 | Platinum Partner
Participant | Platinum Partner

Multi-Language Subscription Preferences Page

SOLVE

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
Contributor

Multi-Language Subscription Preferences Page

SOLVE

Hi Michèle, 

 

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

 

Cheers,

Christoph

0 Upvotes
MFischer
Participant | Platinum Partner
Participant | Platinum Partner

Multi-Language Subscription Preferences Page

SOLVE

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 Upvotes
fiberpunk
Contributor

Multi-Language Subscription Preferences Page

SOLVE

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