简体   繁体   中英

How can I override defaults in jQuery Fullcalendar

I use Fullcalendar on my site, but I need all text in different language. There is piece of code in that plugin:

 // function for adding/overriding defaults

 var setDefaults = fc.setDefaults = function(d) {
    $.extend(true, defaults, d);
 };

But I have no ideas how I can use it. Please, I need help.

You just override the settings when creating the fullcalendar. Like this:

 var options = {
   theme: true,
   header: {
    left: 'prev,next today',
    center: 'title',
    right: 'month,agendaWeek,agendaDay'
   },
   timeFormat: {
    agenda: 'h(:mm)t{ - h(:mm)t}',
    '': 'h(:mm)t{-h(:mm)t }'
   },
   monthNames: ["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" ], 
   monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'],
   dayNames: [ 'Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
   dayNamesShort: ['Dom','Lun','Mar','Mié','Jue','Vie','Sáb'],
   buttonText: {
    today: 'hoy',
    month: 'mes',
    week: 'semana',
    day: 'día'
   }
  };

    $('#calendar').fullCalendar(options);

The properties for this kind of thing are documented here:

http://arshaw.com/fullcalendar/docs/text/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM