Change the language of the embedded form when the website's language changed

  • Angel Baena
    Asked on May 5, 2023 at 12:07 AM

    Hello, this works perfect. In my case I have my form embedded in a wordpress using polylang plugin to manage different languages. Is it possible that when users change web language the form uses that language by default?

  • Shirized Ina Garces JotForm Support
    Replied on May 5, 2023 at 2:51 AM

    Hi Angel,

    Thanks for reaching out to Jotform Support. Can you send me the link to your form so I can take a look at it for you? Also, the language of the form can be changed by using the language parameter in the form URL. By specifying the appropriate language option, you can embed the form on the web page. This can be possible by using the Iframe code method.

    If that’s not exactly what you’re looking for, can you explain a bit more so I can help you better? 

    Let us know if there’s anything else we can help you with. 

  • a.baena
    Replied on May 5, 2023 at 4:34 AM

    Thank you Shirized,

    That will work. What modification should I do in the iframe code? I'm no expert in code and I don't see how.

    Best regards,

  • Billy JotForm Support
    Replied on May 5, 2023 at 5:30 AM

    Hi Angel,

    Thanks for getting back to us. My colleague suggested that you add a URL parameter on the iframe's src attribute. To give you a general idea of what this is, I highly recommend that you go over this tutorial first before moving on.

    The screenshot below is the iframe embed code. The highlighted part is the URL parameter:

    Change the language of the embedded form when the websites language changed Image 1 Screenshot 20

    Here's the actual code:

    <iframe
      id="JotFormIFrame-231242258642048"
      title="Form"
      onload="window.parent.scrollTo(0,0)"
      allowtransparency="true"
      allowfullscreen="true"
      allow="geolocation; microphone; camera"
      src="https://form.jotform.com/231242258642048?language=it"
      frameborder="0"
      style="min-width:100%;max-width:100%;height:539px;border:none;"
      scrolling="no"
    >


    Pay attention to the link after the src attribute. This tells the browser to load the language Italiano (it for Italiano, cn for Chinese, en for English, and so on). The way you want it to be set up is that the form's language should also change when the language where it is embedded is changed. Technically, the website should be passing a dynamic value to the embedded form.

    The issue is that the embedded form won't be able to pull the dynamic value from the website where it is embedded (and vice versa) by relying alone on URL parameters. We have to use JavaScript to set this up on the backend but this is something that we're unable to provide, unfortunately.

    I highly recommend that you reach out to one of our Solutions Partners here to further assist you with setting this up.

    If that isn't an option, you can just get rid of the language picker of your website and rely on the form's built-in language picker.

    Reach out again if you need any other help.