If a survey is scripted in several languages, and respondents should select the survey language they want to answer in, a special set-up should be made. Such surveys are usually run in multi-lingual countries, such as Belgium, Canada or Switzerland.
1. Add the necessary survey languages and translations for them using features in the Translation tab.
2. In the Questions tab add a page in the first position (that should be prior to all other pages) and a question in that page. Name the question LANG. Write the question text asking a respondent to select the survey language, and provide the relevant answer options:
3. Add another page in the second position and name it REDIRECT. It will serve as a place from which the respondents will be redirect to the necessary survey language. This page should not contain any questions.
There should be written some text in the Content tab (e.g. "Please wait...").
And then the JS code should be put in the Javascript tab. An example (the text marked in blue should be amended in each survey):
document.querySelector("body").style.display = "none";
window.addEventListener("load", () => {
response.answers.forEach((answer) => {
var next_button = document.querySelector("#p_next");
if(answer.questionCode == "LANG") {
switch(Number(answer.code)) {
/* Each case is the answer code in the question*/
case 1:
window.location.replace("https://survey.synoint.com/en_CA/p/740004/57068");
break;
case 2:
window.location.replace("https://survey.synoint.com/fr/p/740004/57068");
break;
default:
next_button.click();
break;
}
}
})
})
In each link you need to define:
- the language code (e.g. "en_CA", "fr") - all the language codes can be found under the Publishing tab;
- the survey ID (e.g. 740004) - it can be found under the Publishing tab or near the name of the survey;
- the page ID (e.g. 57068) of the following page after the REDIRECT page - it can be found by clicking the right mouse button on the particular page at the right side of the Questions tab, then "Inspect", and in the separate tab the code of the third page data-page-id should be taken (because the respondents should be redirected to the page that is in the third position after LANG (first one) and REDIRECT (second one)).
4. Test your survey. After selecting the language in the first question, the following questions should be presented in that language.
If a survey has more than two language selections, the setup should be updated this way:
- in the JS field: by adding another case (e.g. case 3), and adding the link with relevant language code;
- in the LANG question: adding the relevant language selection(s).