0

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

asma dev
  • 13
  • 8
  • Check this topic i hope it helps you [DateTimePicker Language](https://stackoverflow.com/questions/19382189/change-language-for-bootstrap-datetimepicker) – Zak Dec 10 '19 at 16:55
  • It won't fix your issue, but `atrLang.slice(atrLang.length -2)` can be just `atrLang.slice(-2)`. :-) – RobG Dec 11 '19 at 06:12
  • 1
    @ZakariaBenHmida thanks for your answer it works now it was just the files upload issue – asma dev Dec 16 '19 at 22:53

0 Answers0