I'm using the Flatpickr to display a date picker. The french names are not showing up? Why?! | XM Community
Question

I'm using the Flatpickr to display a date picker. The french names are not showing up? Why?!

  • 11 January 2021
  • 2 replies
  • 99 views

Badge +2
  • QPN Level 1 ●
  • 6 replies

Hello,
I've input the flatpickr into the header in my project and the question code as directed from this reply from Tom G on the following post https://www.qualtrics.com/community/discussion/11756/change-language-using-flatpickr.
I'm still unable to view the french months. Any help would be appreciated.
image.png
image.png


2 replies

Userlevel 7
Badge +27

Hi there, if you still need, I was able to get this to work on my end by adapting the code in this thread. I included Spanish also just to see how adding more languages would go. For your survey, first head to the General section of the survey's Look & Feel and add the below to the survey's Header:





Then, head over to the Translations section of the Builder and add "French (Canada)" as a language.
Finally, create a Text Entry question and add the below to the question's JavaScript:
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/

if ("${e://Field/Q_Language}" == "EN") {
lang = "default";


if ("${e://Field/Q_Language}" == "ES-ES") {
lang = "es";


if ("${e://Field/Q_Language}" == "FR-CA") {
lang = "fr";



});

Qualtrics.SurveyEngine.addOnReady(function()
{
jQuery("#"+this.questionId+" .InputText").flatpickr({
"locale": lang,
dateFormat: "Y-m-d",
maxDate: "today"
  });

});

Userlevel 7
Badge +27

https://community.qualtrics.com/XMcommunity/discussion/comment/52094#Comment_52094 You don't need if statements to set the variable lang.

"${e://Field/Q_Language)".substr(0,2).toLowerCase();
does it for you. The OP probably didn't load the l10n files.

Leave a Reply