In this article
For each open text question that you want to translate the responses for, you need to add an open text variable in which the translated responses are to be stored.
The example below - shows two open text questions which will be presented to (in this case) French respondents, q1_fr and q2_fr. The responses to these questions will be translated to English and put into the hidden variables q1_eng and q2_eng respectively. In this example the hidden variables have been put into a Translations folder to keep the Questionnaire Tree tidy.
Figure 1 - Example of survey questions
Each open text question (q1_fr and q2_fr) will have "normal" title, text and instructions in the selected survey language, and script in the Validation tab to call the translation engine and specify the required language.
The call to the translator function uses the format:
SurveyTranslator.Translate([Target Question Id], [Target Language Id], [Source Question Id] (Optional), [Source Language Id] (Optional))
In the validation tab of the open text question it can thus be called as:
SurveyTranslator.Translate("q1_eng", 9);
where "q1_eng" is the target hidden variable and 9 is the target language id (in this case English) - .
Figure 2 - Example of the script in use
The function can also be called by explicitly stating the source question id and source language as shown below:
SurveyTranslator.Translate("q2_eng", 9, "q2_fr", 12);
Note: If you specify both the source and target languages, then the extension will only be able to translate from the specified source language. If you only specify the target language then the extension will translate any language it recognizes into the target language.