Leaving Fullcalendar in the en-BR language
Hello, I downloaded a template fullcalendar from Adan Shaw, only the default language is English, I would like to leave it in Portuguese. How do I carry out this change? Thanks.
3 answers
Inside the folder you downloaded from fullcalendar, you have the lang subfolder that contains all languages supported by fullcalendar
Copy javascript pt-br.js
and include it in your project.
Your header would look like this:
<script src='fullcalendar/fullcalendar.js'></script>
<script src='fullcalendar/lang/pt-br.js'></script>
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
//toda chamada de texto do fullcalendar será buscada do arquivo pt-br.js
});
});
</script>
Here is the official documentation that can help you.
Try changing your fullcalendar settings like this:
calendar = $('#calendar').fullCalendar({
ignoreTimezone: false,
monthNames: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
monthNamesShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
dayNames: ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sabado'],
dayNamesShort: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab'],
titleFormat: {
month: 'MMMM yyyy',
week: "d[ MMMM][ yyyy]{ - d MMMM yyyy}",
day: 'dddd, d MMMM yyyy'
},
columnFormat: {
month: 'ddd',
week: 'ddd d',
day: ''
},
axisFormat: 'H:mm',
timeFormat: {
'': 'H:mm',
agenda: 'H:mm{ - H:mm}'
},
buttonText: {
prev: " ◄ ",
next: " ► ",
prevYear: " << ",
nextYear: " >> ",
today: "Hoje",
month: "Mês",
week: "Semana",
day: "Dia"
}
});
You can set the property locale
to pt-br
.
However, even changing the locale
, I had to set other properties manually, such as timeFormat
, buttonText
, among others.
Check out my current settings:
this.calendarOptions = {
locale: 'pt-br',
timeFormat: 'HH:mm',
editable: true,
eventLimit: false,
displayEventTime: this.displayEventTime,
slotLabelFormat: 'HH:mm',
allDayText: '24 horas',
columnFormat: 'dddd',
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay,listMonth'
},
buttonText: {
today: 'Hoje',
month: 'Mês',
week: 'Semana',
day: 'Hoje',
list: 'Lista'
},
events: this.eventsCalendar
};
Documentation with more details about locale: https://fullcalendar.io/docs/locale