How to automatically translate survey depending on answer instead of dropdown menu | XM Community
Skip to main content
Solved

How to automatically translate survey depending on answer instead of dropdown menu

  • December 21, 2021
  • 4 replies
  • 397 views

CarolK
Level 5 ●●●●●
Forum|alt.badge.img+46
  • Level 5 ●●●●●
  • 408 replies

(There is already a question for this but apparently something has changed so the previous answer no longer works).
I have a survey that is translated. However, we cannot show the menu dropdown to the recipient; we need to be able to set the Language within the survey proper.

  • Attempts to set or re-set Q_lang via the survey flow (which is the need) does not have any impact; Q_lang appears to only work if it can be applied to the URL.

  • Setting Q_Language similarly has no impact.

  • Setting Language in the survey flow is not viable; Qualtrics no longer allows language to be set in this way.

Does anyone have another way to do this? It has to be done within the survey & survey flow so that logic can be applied to the settings.

Best answer by KimothiSaurabh

CarolK - You can place below Javascript code in that language question and it should work. Please update if-else lines as per language available in that question.
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
 this.questionclick = function(event,element){
    if (element.type == 'radio')
    {
      var choiceNum = element.id.split('~')[2];
if(choiceNum==1)
{
jQuery("select[id='Q_lang']").val('EN');
}
       if(choiceNum==2)
{
jQuery("select[id='Q_lang']").val('FR');
}
jQuery("select[id='Q_lang']").trigger( "change" );
    }
  }
});

This is the language question:-
image.png

4 replies

Forum|alt.badge.img+18
  • Level 3 ●●●
  • 78 replies
  • Answer
  • December 31, 2021

CarolK - You can place below Javascript code in that language question and it should work. Please update if-else lines as per language available in that question.
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
 this.questionclick = function(event,element){
    if (element.type == 'radio')
    {
      var choiceNum = element.id.split('~')[2];
if(choiceNum==1)
{
jQuery("select[id='Q_lang']").val('EN');
}
       if(choiceNum==2)
{
jQuery("select[id='Q_lang']").val('FR');
}
jQuery("select[id='Q_lang']").trigger( "change" );
    }
  }
});

This is the language question:-
image.png


CarolK
Level 5 ●●●●●
Forum|alt.badge.img+46
  • Author
  • Level 5 ●●●●●
  • 408 replies
  • January 3, 2022

I must be doing something wrong. This seemed to work, until I put the Display logic onto the language options (I actually have 5 languages in the survey, but all options are not available to all recipients). Then even after I removed that logic again, I can't repeat the test and have it work. So I've messed something up. But thank you KimothiSaurabh that puts me on the trail of a solution.


Forum|alt.badge.img+1
  • 2 replies
  • July 23, 2022

CarolK
Maybe try a pre-survey that automatically redirects with the Q_Language code in the URL to the main survey (in order to pass that language variable as embedded data)? I suggested that approach in another question.
How to automatically translate survey depending on answer instead of dropdown menu — Qualtrics Community


CarolK
Level 5 ●●●●●
Forum|alt.badge.img+46
  • Author
  • Level 5 ●●●●●
  • 408 replies
  • July 24, 2022

Thank you Lon -- but we would never use a separate survey (and thus twice as many completes on our license) in this way.