Changing Q_Language once a survey has started | XM Community
Skip to main content

I am conducting a survey in several countries and in different languages.  I have hidden the language dropdown and have been using Q_Language=EN (for example) in the survey link to set the language for each country.

Canada is part of the survey and I want Canadians to choose English or French as they wish so I have added in a question at the very beginning of the survey (visible to Canadians only) which asks which is their preferred language.

If they choose (for example) French I have set up a branch and set the embedded to Q_Language = FR-CA.

Trouble is it doesn’t work.  The survey continues in English even though I have added a French Canadian translation.

Any idea why it doesn’t work - can Q_Language be changed once the survey has started?

Is there another way of achieving the same result, i.e. Canadians (only) having the ability to choose English or French?

Many thanks in advance.

I don’t think changing Q_language midway will have the impact. However, the language dropdown will.

Since you hid it away, try switching the html element because that what happen when you use the dropdown. And link the answer with this element.

<html lang=”EN”> or lang = “FR”


I don’t think changing Q_language midway will have the impact. However, the language dropdown will.

Since you hid it away, try switching the html element because that what happen when you use the dropdown. And link the answer with this element.

<html lang=”EN”> or lang = “FR”

I tried changing the lang attribute with the page onload java script, didn’t work. Maybe we can use java script to select the language dropdown for the survey audience but still hide that from them.


I am using the following to hide the dropdown:

#Q_lang {
visibility: hidden;
}

Is it possible to hide for everyone except Canada and then only give Canada FR and EN options?

Someone must have come across this problem before??


@Arthur_Fletcher,

You can do this:

Qualtrics.SurveyEngine.addOnload(function() {
var lang = jQuery("#Q_lang");
if(lang.val()!="FR-CA") lang.val("FR-CA").trigger("change");
});

 


@Arthur_Fletcher,

You can do this:

Qualtrics.SurveyEngine.addOnload(function() {
var lang = jQuery("#Q_lang");
if(lang.val()!="FR-CA") lang.val("FR-CA").trigger("change");
});

 

@TomG It worked like a charm.


Hi TomG

Thanks for the advice (and to dxconnamnguyen for testing out).

In my survey, I have  question for Canadians only which asks which is there preferred language, if they choose French then my embedded data statement sets Q_Language=FR-CA.

I have added your statement (in the Custom CSS box in Look and Feel/Style) and it doesn’t change the language, the survey just continues in English

Sorry, I am not a JS/html person and I don’t fully understand what’s going on here.  

Qualtrics.SurveyEngine.addOnload(function() {

var lang = jQuery("#Q_lang");

if(lang.val()!="FR-CA") lang.val("FR-CA").trigger("change");

});

I now realise that I should be adding the JS into the actual question (doh!) but which question?  The question which asks which language they prefer or the next one?  And do I still need to change the Q_Language in embedded data?


@Arthur_Fletcher You can add it in the Java section of the question, follow this guidance: https://www.qualtrics.com/support/survey-platform/survey-module/question-options/add-javascript/

Change the condition in if(lang.val()!="FR-CA"a little to fit yours. For example, like this:

Qualtrics.SurveyEngine.addOnload(function()
{
var lang = jQuery("#Q_lang");
var x = "${q://QID23/ChoiceGroup/SelectedChoices}";
if(x=="French") {lang.val("FR").trigger("change");}
if(x=="English") {lang.val("EN").trigger("change");}
});

In this example QID23 is my Language question, change it to yours.
Try it and let me know if anything comes up


I now realise that I should be adding the JS into the actual question (doh!) but which question?  The question which asks which language they prefer or the next one?  And do I still need to change the Q_Language in embedded data?

PS: Add it to the next one, and you don’t need to change the Q_Language

 


@Arthur_Fletcher,

You can find the solution to your issue here.

Just add the CSS to Custom CSS and the JS to your question.  Update your choice labels to be:

English<span class="langCode">EN</span>
French<span class="langCode">FR-CA</span>

 


HI TomG and dxconnamnguyen

Thanks for all your help on this one, it works!

In the end I did this in Custom CSS (to hide the language drop down):

#Q_lang {
visibility: hidden;
}

And in the question following my language choice question, I did this in the </> Javascript section (to identify the language choice and reset the language for this respondent):

Qualtrics.SurveyEngine.addOnload(function()

{

var lang = jQuery("#Q_lang");

var x = "${q://QID23/ChoiceGroup/SelectedChoices}";

if(x=="French") {lang.val("FR").trigger("change");}

if(x=="English") {lang.val("EN").trigger("change");} });

 

I changed ‘QID23’ to the QID for my language choice question.

I am most grateful but its clear that I need to learn some JS basics!

Arthur


Leave a Reply