Multilingual Content Forms

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

@Indra , @Anton

Could either of you help our friend @RafaelBran :grinning_face:

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()

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.

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: <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
}

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

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: Translations Hooks | Weglot

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.

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