|Written for||Scriptwriters and survey authors|
|Keywords||language; screen; web; script; design; askiadesign|
Compatible since askiadesign 188.8.131.52
Download the example qex file and/or click here to access a live demo
First we need to create a Language variable and one routing Set Language per languages in the survey. Make sure to tick during and after for the routings Set Language. In the example qex file, we got two languages, Français and English.
In your Internet Settings, add the following code in Before Content of the Contents tab:
Modify the code:
You will need to change the reference of your Language question in the code so if it's named differently, replace Language by your Shortcut caption of your language variable. You will also need to modify the option list of the select. The list of option should be the same as your list in the definition of your Language variable and the id and value should be equal to the order of your item in the definition for the id and to the internal response code for the value. So if you got German, Français and English, German will have an id of 1, Français of 2 and so on. And the value 11 for German, 12 for Français and so on.
To know the value to use, in the Language screen, click on the HTML code tab and check the value applied to each responses.
Below the code generated for the responses in the HTML code tab:
As we can see the value to use for Français is 11 and 12 for English.
This piece of code will add a drop down menu on all the screen with the list of Language available and when you will select another language, the system will update the screen with the relevant language selected.
Finally, if you show the Language question (you make it visible for the respondents). Make sure to hide the drop down menu of the languages. To be able to do this, go to the properties of the Language screen and in the Contents tab, untick use default for the Before content and let it blank.
Explanation of the code:
The first row create a hidden input which will be used to modify the value of a previous question (here the Language variable). The name's parameter should be started with an underscore and then the shortcut of the variable. Attention, it doesn't work for variables inside a loop.
Here we used it to change Language at anytime but you can imagine using it for others stuff as change web screens at run time. You offer on every screen to optimize the presentation for mobile / tablet / web (see the article Create two screen web groups for Desktop and Mobile).