I'm using Bootstrap datepicker and I tried to change the language value with a variable content but it doesn't take it . I found a question already asked about this that seems like my problem , i did all the solutions given but doesn't work neither. Actually it's always in the default language "en".
this is the question bootstrap-datepicker set language globally
this is a part of my code in jquery
var atrLang= $('.datepicker').attr('data-lang');
//this retrn "langFr" for exemple
var langUp= (atrLang.slice(atrLang.length -2)).toLowerCase();
//this return "fr"
//i tried to change the default language like this
//$.extend( $.fn.datepicker.defaults, {format: 'dd-mm-yyyy', language: langUp} );
//it return an error "typeError: dates[this.o.language] is undefined"
$('#datepicker_drop_off').datepicker({
todayHighlight: true,
weekStart: 1,
startDate: new Date(),
//add the current language to the language of the calendar
language: langUp,
})
I hope you can help me. Thanks