CMS Development

RafaelBran
Member

Multilingual Content Forms

SOLVE

I am a complete noob in codes etc.

I am building a website in WordPress (with Elementor) and I would like to integrate a multilingual Contact form from Hubspot based on the language that the visitor will choose.

 

I tried different things but I was not able to solve this and the English form is the one appearing all the time.

 

I believe I need a conditional code to say something like : If the visitor chooses EN and is using [if lte IE 8], use this form OR if the visitor choses FR, then use that code.

 

Can anybody suggest anything for this?

 

Thank you in advance

 

0 Upvotes
1 Accepted solution
Indra
Solution
Guide | Elite Partner
Guide | Elite Partner

Multilingual Content Forms

SOLVE

Hi @RafaelBran,

 

With WeGlot i'm not familiar, but if you say you place the French code on the French page it looks like a bug inside WeGlot. 

 

An alternative that you could do is check the page language and set the form if it's a certain language.

You can checkout this example: https://codepen.io/ind88/pen/GRErWPm

 

The code is like this

HTML:

Page language:&nbsp;<strong class="output"></strong>

Javascript&colon;

// Get page language
var lang = document.documentElement.lang;

// Get output for demo usage
var el = document.querySelector('.output');
// Set output
el.innerHTML = lang;
// Debug info
console.log('Page language' + lang);

// If conditions
if(lang == 'fr'){
  // Your French code
} else {
  // fallback or default
}

 


Indra Pinsel - Front-end developer - Bright Digital
Did my answer solve your issue? Help the community by marking it as the solution.


View solution in original post

7 Replies 7
Indra
Guide | Elite Partner
Guide | Elite Partner

Multilingual Content Forms

SOLVE

Hi @RafaelBran,

 

Since you have problems translating within WordPress combining WeGlot, I would suggest searching on there website for support.

 

Perhaps this page will help you translating custom parts: https://developers.weglot.com/wordpress/filters/translations-filters 

 

The first option I mentioned with javascript should also still work if you don't want to work with filters because it's checking the page language.


Indra Pinsel - Front-end developer - Bright Digital
Did my answer solve your issue? Help the community by marking it as the solution.


0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

Multilingual Content Forms

SOLVE

Thanks for taking the time to loop back here, @Indra 🙌


HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.
Learn More.


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !
0 Upvotes
DGuas
Member

Multilingual Content Forms

SOLVE

@dennisedson , @Indra , @Anton I have exactly the same problem on our website. Could you help us out? As we use weglot for translating the whole website, but just the Hubspot form is not translated. I would very highly appreciate help in this regard.

0 Upvotes
Indra
Solution
Guide | Elite Partner
Guide | Elite Partner

Multilingual Content Forms

SOLVE

Hi @RafaelBran,

 

With WeGlot i'm not familiar, but if you say you place the French code on the French page it looks like a bug inside WeGlot. 

 

An alternative that you could do is check the page language and set the form if it's a certain language.

You can checkout this example: https://codepen.io/ind88/pen/GRErWPm

 

The code is like this

HTML:

Page language:&nbsp;<strong class="output"></strong>

Javascript&colon;

// Get page language
var lang = document.documentElement.lang;

// Get output for demo usage
var el = document.querySelector('.output');
// Set output
el.innerHTML = lang;
// Debug info
console.log('Page language' + lang);

// If conditions
if(lang == 'fr'){
  // Your French code
} else {
  // fallback or default
}

 


Indra Pinsel - Front-end developer - Bright Digital
Did my answer solve your issue? Help the community by marking it as the solution.


Indra
Guide | Elite Partner
Guide | Elite Partner

Multilingual Content Forms

SOLVE

Hi @RafaelBran,

 

What plugin do you use for the multilingual content tot display? If it's wpml you van use this tot target your language:

if( 'en' == ICL_LANGUAGE_CODE ) {

     //english

}

You can also use the object:

 

global $sitepress;

//get current language

echo $sitepress->get_current_language()


Indra Pinsel - Front-end developer - Bright Digital
Did my answer solve your issue? Help the community by marking it as the solution.


RafaelBran
Member

Multilingual Content Forms

SOLVE

Hello, First of all, thank you for taking the time to answer.

 

Now, to answer the question, I think I have none of this. I am basically using WeGlot to translate our website and I can only enbed the code through elementor. 

 

So when I am on the websote in French and I want to paste the html code to the French form, it brings me to the English website every time which is not mirrored. 

dennisedson
Community Manager
Community Manager

Multilingual Content Forms

SOLVE

@Indra , @Anton 

Could either of you help our friend @RafaelBran  😀


HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.
Learn More.

0 Upvotes