I need to change the language of my calendar in the angular version 7. I have not found much documentation about this. The main thing is to change the language of the days that appear on the calendar.
!-- begin snippet: js hide: false console: true babel: false -->
import { Component, OnInit, ViewChild } from '@angular/core';
import { CalendarComponent } from 'ng-fullcalendar';
import { Options } from 'fullcalendar';
@Component({
selector: 'app-calendario',
templateUrl: './calendario.component.html',
styleUrls: ['./calendario.component.css']
})
export class CalendarioComponent implements OnInit {
//calendario
calendarOptions: Options;
displayEvent: any;
@ViewChild(CalendarComponent) ucCalendar: CalendarComponent;
constructor() { }
ngOnInit() {
this.calendarOptions = {
editable: true,
eventLimit: false,
header: {
left: '',
center: 'title',
right: 'month'
},
events: []
};
}
}
I try to add the property locale = 'es' in the calendarOptions, but it does not work, add this to my angular json, but I do not know how to implement it
"scripts": [
"node_modules/fullcalendar/dist/locale/es.js"
]
Thanks Gabriel I make it work with this approach
First make sure you have the import of your desire lenguage
import esLocale from '@fullcalendar/core/locales/es';
import frLocale from '@fullcalendar/core/locales/fr';
In your html file, in the full-calendar selector, you should assign values to locales and locale options.
<full-calendar
defaultView="dayGridMonth"
[locales]="locales"
locale="es"
[weekends]="false"
[plugins]="calendarPlugins"></full-calendar>
Then a variable that holds all the languages that you need
locales = [esLocale, frLocale];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With