Specify language to use when form is embedded

  • Profile Image
    samanavitas
    Asked on August 18, 2015 at 10:35 AM
    How can I directly specify which language to use when embedding form?
  • Profile Image
    samanavitas
    Answered 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.

  • Profile Image
    Charlie
    Answered 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.

  • Profile Image
    samanavitas
    Answered 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.

  • Profile Image
    Boris
    Answered on August 28, 2015 at 05: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.

  • Profile Image
    samanavitas
    Answered on August 28, 2015 at 09: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.

  • Profile Image
    Boris
    Answered 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.

  • Profile Image
    samanavitas
    Answered on August 30, 2015 at 04: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>
  • Profile Image
    Shadae
    Answered on August 30, 2015 at 12:55 PM

    Hi samanavitas,

    As stated by my colleague, as the script is running on your page and not within an iFrame, the parameter would have to be passed through your page URL.

    The example you provided above would be possible but would need to be ran within an iFrame but not be affected by your pages scripts.

    Thank you

  • Profile Image
    samanavitas
    Answered on October 12, 2015 at 04: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.

     

  • Profile Image
    samanavitas
    Answered on October 12, 2015 at 05: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!

  • Profile Image
    samanavitas
    Answered on October 12, 2015 at 05: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.

  • Profile Image
    EltonCris
    Answered on October 12, 2015 at 07: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!

  • Profile Image
    carlosxarmando
    Answered on March 07, 2016 at 05:46 AM

    For English (USA)

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

    But for English (UNITED KIGDOM)?

    Ty :)

  • Profile Image
    Boris
    Answered on March 07, 2016 at 07:30 AM

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

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

    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.