How can I set the language based on a question in the survey? | XM Community
Skip to main content
Solved

How can I set the language based on a question in the survey?


Forum|alt.badge.img+2

Hi,

 

I have a survey that will have 5 languages. 

How can I use a question at the beginning to set the language of the survey? 

Thanks

Benjamin

Best answer by TomG

@bjonasch,

I think this is what you are looking for.  Note: It is not intended for Simple layout.

View original

17 replies

chackbusch
QPN Level 5 ●●●●●
Forum|alt.badge.img+22
  • QPN Level 5 ●●●●●
  • 414 replies
  • September 5, 2024

@bjonasch If you just want to preselect one of the language options when the survey is started, you can place this JavaScript for the first question and choose the relevant language code: 

Qualtrics.SurveyEngine.addOnload(function()
{
	/*Place your JavaScript here to run when the page loads*/
	document.getElementById('Q_lang').value = 'DE';
});

If you want to actually ask a question “Which language do you prefer?”, then you would need some different logic. But in this case, the language dropdown should probably not be shown?

Best
Christian


Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 13 replies
  • September 6, 2024

Hi, thank you! 

Exactly, the language dropdown should not show and the language should be set by that question. 

 

The survey should pre-select the language of the browser of the respondent when started and then he could change it in the question if needed. No need for the language dropdown. 

Thank you!


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • September 6, 2024
bjonasch wrote:

Hi, thank you! 

Exactly, the language dropdown should not show and the language should be set by that question. 

 

The survey should pre-select the language of the browser of the respondent when started and then he could change it in the question if needed. No need for the language dropdown. 

Thank you!

This should be the expected behaviour as mentioned here.


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5923 replies
  • Answer
  • September 6, 2024

@bjonasch,

I think this is what you are looking for.  Note: It is not intended for Simple layout.


Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 13 replies
  • September 9, 2024
TomG wrote:

@bjonasch,

I think this is what you are looking for.  Note: It is not intended for Simple layout.

Thank you! How do I add this to Qualtrics? 


Nam Nguyen
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+29
  • QPN Level 8 ●●●●●●●●
  • 1091 replies
  • September 9, 2024
bjonasch wrote:
TomG wrote:

@bjonasch,

I think this is what you are looking for.  Note: It is not intended for Simple layout.

Thank you! How do I add this to Qualtrics? 

  1. Follow the link, you will find 3 kind of code
  2. Hide the language selector by copy the CSS code to Custom CSS
  3. Paste HTML to survey answers of the language question. Change the Language code to suit you
  4. Add JavaScript to that question

Hope this helps.


Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 13 replies
  • September 11, 2024

Thank you


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5923 replies
  • September 11, 2024

😡


Nam Nguyen
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+29
  • QPN Level 8 ●●●●●●●●
  • 1091 replies
  • September 11, 2024
bjonasch wrote:

Thank you

@bjonasch All thanks to @TomG man, I’m just interpreting his solution 😁


Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 13 replies
  • September 12, 2024
TomG wrote:

@bjonasch,

I think this is what you are looking for.  Note: It is not intended for Simple layout.

Thank you


Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 13 replies
  • September 16, 2024
TomG wrote:

@bjonasch,

I think this is what you are looking for.  Note: It is not intended for Simple layout.

Hi, the link does not work anymore, can you maybe post this again? 

 

Thank you!


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5923 replies
  • September 16, 2024
bjonasch wrote:
TomG wrote:

@bjonasch,

I think this is what you are looking for.  Note: It is not intended for Simple layout.

Hi, the link does not work anymore, can you maybe post this again? 

 

Thank you!

Reposted here.


Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 13 replies
  • September 17, 2024

Thank you @TomG 😀


Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 13 replies
  • September 17, 2024

When I put in the html code as survey answers it works but shows it like this in the survey

 

“EnglishEN”

 

I used “English<span class="langCode">EN</span>” as the answer option of the question

 

How can I get rid of the “EN” shown in the option? 


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5923 replies
  • September 17, 2024

The css hides the span with the class langCode:

.LanguageSelectorContainer, span.langCode { display:none; }

Make sure you’ve added that line to Custom CSS.

If that doesn’t work there is a conflict in the CSS. Not the ideal solution, but you could change display:none; to display:none !important;


Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 13 replies
  • September 18, 2024

Thank you!!


Forum|alt.badge.img+1
  • 4 replies
  • February 27, 2025

Hi! I added the code from the Github link to my survey and it works like a charm. However, I would like to use a dropdown question instead of a list question. How can I adapt the code so that it works with a dropdown question? ​@TomG 


Leave a Reply