Specify language to use when form is embedded

  • samanavitas
    Asked on August 18, 2015 at 10:35 AM
    How can I directly specify which language to use when embedding form?
  • Charlie
    Replied on August 18, 2015 at 10:47 AM

    Hi,

    You can set the default language in your Language translation options.

    Here's a guide on that: https://www.jotform.com/help/298-How-to-make-your-forms-multilingual.

    Specify language to use when form is embedded Image 1 Screenshot 30

     

    When you embed the form, the default language will be used.

    If you want your form's language to dynamically change, you can try enabling the "Detect Language" option.

    Specify language to use when form is embedded Image 2 Screenshot 41

     

    I hope that helps. Do let us know if you need more assistance on this.

  • samanavitas
    Replied on August 18, 2015 at 10:57 AM

    I know all these things, but I would like to have extra option to specify when calling a form to select language. Maybe via ? parameter or something like that.

  • Charlie
    Replied on August 18, 2015 at 12:39 PM

    Hi,

    You can do that by adding this parameter in your src link or in your form URL.

    Here's a test form that I made:

    http://form.jotformpro.com/form/52284815301955?language=en

    http://form.jotformpro.com/form/52284815301955?language=sv

    You can see how the language selection changes based on the parameter.

    You can add ?language on the source link. Make sure though that you are using the correct value on the language.

    For the embed code, this how it works:

    <script type="text/javascript" src="//form.jotformpro.com/jsform/52284815301955?language=sv"></script>

     

    Let us know if that works.

  • samanavitas
    Replied on August 28, 2015 at 12:54 AM

    It works properly for direct call -like your first example. For jsform call like you example at the end does not. It displays a default language version.

  • Boris
    Replied on August 28, 2015 at 5:34 AM

    Yes, you are correct. This method doesn't work directly on the Embed Script link to the form (the link with jsform in it).

    However, it is working fine for the JS form if you are calling its page with that parameter in the link of the page. For example, if your website where this form is JS embedded is http://example.com/ , you would be able to change the language by calling the page as follows:

    http://example.com/?language=en

    http://example.com/?language=sv

    Please let us know if you need further assistance, and we will be happy to help.

  • samanavitas
    Replied on August 28, 2015 at 9:17 AM

    But why not? Sounds like bug to me or half implemented feature. I would like to stay away from using iframes just for language switching to work. Also since each form involves so much work to create and maintain I do not want to have one totally independent form per language. 

     

    This must be solvable differently. Can you, please, talk to developers to see what can be done as this is very important to us users?

     

    Thank you.

  • Boris
    Replied on August 28, 2015 at 10:57 AM

    I'm afraid you may have misunderstood the last post. Language switching through URL parameters is already implemented and available in JS embed, you do not need to use any iFrame codes.

    The script embed method, since the script is running on your page (and not in an iFrame), will be taking any URL parameters from the page on which it is embedded on. So to a JS embedded form, you pass parameters by passing them to your own page.

    This is so with all URL parameters and scripts, not just language switching and JotForm. Any script sees URL parameters from the page on which it is running, not from the link that was used to call the script.

    I will try and use another example to explain how the URL parameters work. If you had a script on http://www.sama-navitas.si/contact/ , we would pass parameters to this script directly through the link of the page:

    http://www.sama-navitas.si/contact/?language=en

    This is how URL parameters work. I hope it helps, please let us know if you need further clarifications. Thank you.

  • samanavitas
    Replied on August 30, 2015 at 4:51 AM

    OK, now I uderstand that. But is it possible to pass language parameter like this (as borrowed from http://stackoverflow.com/questions/5292372/how-to-pass-parameters-to-a-script-tag):

     

    <script src="http://path.to/widget.js" param_a = "2" param_b = "5" param_c = "4"> </script>
  • samanavitas
    Replied on October 12, 2015 at 4:48 PM

    I still need this functionality to pass parameters to script. Other methods are not reliable or not really usable. Having language passed via ?lang is ugly and does not help if language must be "de", but Jotform wants it to be de-DE, etc.

    Script parameters would solve a lot.

     

  • samanavitas
    Replied on October 12, 2015 at 5:18 PM

    This language passing does not work here:

     

    http://www.sama-navitas.si/kontakt-za-it/?lang=en

     

    It displays form in default language and one must manually select english languge from the menu on the top right of the form itself!

  • samanavitas
    Replied on October 12, 2015 at 5:42 PM

    Hmm, ?language works. I would rather not reprogram Wordpress just to make Jotform work. :( Jot form should be more wordpress and wpml friendly.

  • Elton Support Team Lead
    Replied on October 12, 2015 at 7:10 PM

    Yes you are right, it is only designed to capture language parameter and not lang.

    You can actually pass the language parameter on the script embed code. Then control its value by writing a custom PHP script. This might work as well. 

    Example:

    <?php

    $lang = $_GET['lang'] || "en";

    if ($lang=="gm") {

        echo '<script type="text/javascript" src="//form.jotformeu.com/jsform/52254737978369?language=gm"></script>';

    }

    elseif ($lang=="sl") {

       echo '<script type="text/javascript" src="//form.jotformeu.com/jsform/52254737978369?language=sl"></script>';

    }

    else {

       echo '<script type="text/javascript" src="//form.jotformeu.com/jsform/52254737978369?language=en"></script>';

    }

    ?>

    I haven't tested this script but you can come up your own working version or let us know if you need further help.

    Thanks!

  • carlosxarmando
    Replied on March 7, 2016 at 5:46 AM

    For English (USA)

    http://example.com/?language=en

    But for English (UNITED KIGDOM)?

    Ty :)

  • Boris
    Replied on March 7, 2016 at 7:30 AM

    For English (UK), please use en-UK in your URL parameter:

    http://example.com/?language=en-UK

    Specify language to use when form is embedded Image 1 Screenshot 20

    If you need any further assistance, please open a new support thread, so that the original poster of this thread doesn't get unnecessary email notifications. Thank you.