Hello!
I have a survey that is in both English and Spanish, and I have set up a calendar in one question using flatpickr. I'm trying to change the code so that participants who complete the survey in English see months in English and Spanish participants see months in Spanish. This is my code so far:
Qualtrics.SurveyEngine.addOnload(function () {
var input = jQuery("#"+this.questionId+" .InputText");
var languages = {
"ES-ES": {
months:["enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"],
},
"EN" : {
months:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
}
};
input.flatpickr({
l10ns: languages['${e://Field/Q_Language}'],
dateFormat: "m/d/Y",
minDate: "12/01/2019",
maxDate: "today"
});
});
I tried to adapt some code for pikaday (https://www.qualtrics.com/community/discussion/6074/date-picker-translations), but obviously I'm doing it incorrectly. Does anyone have any ideas? Thanks so much!
Shivani
Change language using flatpickr
Best answer by TomG
This should work:
Qualtrics.SurveyEngine.addOnload(function () {
jQuery("#"+this.questionId+" .InputText").flatpickr({
locale: "${e://Field/Q_Language}".substr(0,2).toLowerCase(),
dateFormat: "m/d/Y",
minDate: "12/01/2019",
maxDate: "today"
});
});
Sign up
Already have an account? Login
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login to the Community
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join.
No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Login with Qualtrics
Welcome! To join the Qualtrics Experience Community, log in with your existing Qualtrics credentials below.
Confirm your username, share a bit about yourself, Once your account has been approved by our admins then you're ready to explore and connect .
Free trial account? No problem. Log in with your trial credentials to join. No free trial account? No problem! Register here
Already a member? Hi and welcome back! We're glad you're here 🙂
You will see the Qualtrics login page briefly before being taken to the Experience Community
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
