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

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

  • January 10, 2021
  • 2 replies
  • 197 views

Forum|alt.badge.img+2
  • QPN Level 2 ●●

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

Tom_1842
Level 8 ●●●●●●●●
Forum|alt.badge.img+28
  • Level 8 ●●●●●●●●
  • November 12, 2022

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"
  });

});


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • November 12, 2022

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.