Topic: angular component datepicker – override locale
Stjepan Marjanovic pro asked 7 years ago
Is it possible to override locales (setup custom set of locales configurations) without changing original mdboostrap localeService?
You proposal is to do it within mdbootrap code (https://mdbootstrap.com/angular/advanced/datepicker/#translation ).
Damian Gemza staff answered 7 years ago
addLocale(locale: IMyLocales) { this.localeService.locales=Object.assign({}, this.localeService.locales, locale); setTimeout(() => { this.setLocaleOptions(); }, 0);
@ViewChild('datePicker') datePicker: MDBDatePickerComponent; public myDatePickerOptions: IMyOptions= { }; ngAfterViewInit() { this.datePicker.addLocale({ de: { dayLabels: { su:'Son', mo:'Mon', tu:'Die', we:'Mit', th:'Don', fr:'Fre', sa:'Sam' }, dayLabelsFull: { su:"Sonntag", mo:"Montag", tu:"Dienstag", we:"Mittwoch", th:"Donnerstag", fr:"Freitag", sa:"Samstag" }, monthLabels: { 1:'Jan', 2:'Feb', 3:'Mär', 4:'Apr', 5:'Mai', 6:'Jun', 7:'Jul', 8:'Aug', 9:'Sep', 10:'Okt', 11:'Nov', 12:'Dez' }, monthLabelsFull: { 1:"Januar", 2:"Februar", 3:"März", 4:"April", 5:"Mai", 6:"Juni", 7:"Juli", 8:"August", 9:"September", 10:"Oktober", 11:"November", 12:"Dezember" }, dateFormat:"dd mmmm yyyy", todayBtnTxt:"Heute", clearBtnTxt:"Klar", closeBtnTxt:"Schließen", firstDayOfWeek:"mo", sunHighlight:true, } }); }
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Pro
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No