I want to translate embedded data based on the survey language. | XM Community
Skip to main content
Solved

I want to translate embedded data based on the survey language.

  • February 20, 2025
  • 7 replies
  • 52 views

Forum|alt.badge.img+1

The embedded data and the survey language are provided by the survey link.
I built the following JavaScript code for the onload section, but it does not work.

Qualtrics.SurveyEngine.addOnload(function()
{
    function translateInteraction() {
    var s= parseInt("${e://Field/Q_Language}");
    var i= parseInt("${e://Field/Interaction}");
    var it= parseInt("{e://Field/Q_Interaction}");
        
    if (s=="DE" && i=="Order Process") {
        Qualtrics.Survey.Engine.setEmbeddedData('Q_Interaction', "Bestellprozess");
    } else {
        Qualtrics.Survey.Engine.setEmbeddedData('Q_Interaction', i);
    }
}
//Translate submitted Interaction based on Survey Language
translateInteraction()
});
If the language is DE, the English text of the variable is displayed. If the language is EN nothing is displayed.
 

This is how the link looks like:
https://phenomenex.iad1.qualtrics.com/jfe/form/SV_afJGKCsvcJ0G6Eu?Interaction=Order%20Process&Q_Language=DE

And this is the question in Qualtrics XM

 

Best answer by jbk

since you asked for other options than JS, Create another set of question for the translated and set the display logic for both these questions. So that, for DE language first set will be displayed and for next EN will be displayed.

You can also have the translated embedded data to display the text in necessary question.

 

Hope this helps!

View original

7 replies

Forum|alt.badge.img+1
  • Author
  • 6 replies
  • February 28, 2025

Am I the only person trying to use translated questions with piped text in the actual question?
Is there a solution in Qualtrics for this? Despite the obvious typo in my script, why might the code not work? Which other options outside JavaScript might be a better solution?

 


  • Level 4 ●●●●
  • 205 replies
  • Answer
  • March 3, 2025

since you asked for other options than JS, Create another set of question for the translated and set the display logic for both these questions. So that, for DE language first set will be displayed and for next EN will be displayed.

You can also have the translated embedded data to display the text in necessary question.

 

Hope this helps!


Forum|alt.badge.img+1

Hi jbk,

Thank you for your response. I have a question for clarification.
You mentioned I can have displayed the translated embedded data in the respective language version.
If I understand this correct, this means, I need to create different links for the survey based on the language/country of the recipient of the email. Is this what you meant?


  • Level 4 ●●●●
  • 205 replies
  • March 3, 2025

Just out of curiosity, is this the only question do you need embedded data in the question or the total survey?


Forum|alt.badge.img+1

Hi jbk,

The idea is running a customer satisfaction survey, covering multiple different touchpoints.
The embedded data should then be used for piped text and display logic.
I wanted to use JavaScript to use the least number of different questions, making the analysis of the data easier.

I hope this makes sense.

 


Forum|alt.badge.img+1

This problem has been resolved by not using JavaScript and building independent surveys for each touchpoint.

 


Forum|alt.badge.img+16

Although it is late and you already have an alternative, another possible tedious method is to replace the embedded data value in the survey flow based on the language at the top before all your questions.

Note:

1) This method doesn’t take into account of survey takers changing language after entering survey.

2) You can continue to use Interaction as analysis factor as a whole across all languages or Interaction2 as analysis factor for a specific language group.

 

For example,

Q_Language = value taken from url

Interaction = value taken from url

 

Branch logic to check the language Q_Language = DE

>Branch logic that checks Interaction = Order Process

» Embedded data Interaction2 = Bestellvorgang (assuming google translate is translated correctly.)

> (Continue branch logic and setting Interaction for other possible types of Interaction)

 

Branch logic to check 2nd language EN

Branch logic to check the language Q_Language = EN

>Branch logic that checks Interaction = Order Process

» Embedded data Interaction2 = Interaction

> (Continue branch logic and setting Interaction for other possible types of Interaction)

 

Branch logic to check a 3rd language, if applicable.

Branch logic to check the language Q_Language = ZH

>Branch logic that checks Interaction = Order Process

» Embedded data Interaction2 = 订单流程 (assuming google translate is translated correctly.)

> (Continue branch logic and setting Interaction for other possible types of Interaction)


Leave a Reply