How to translate the Full Calendar header schedule?

Asked

Viewed 980 times

1

Greetings, friends of Stack Overflow! I’m one step away from completing a schedule using the fantastic plugin Full Calendar, in which I am grateful to exist. However, I am having some translation problems with it:

Unfortunately, the locale/language property is not working properly in my code (I’m using C# with MVC5 and JS), so I’m having to translate by hand:

$('#calendar').fullCalendar({
    monthNames: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio',
        'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro',
        'Novembro', 'Dezembro'],
    dayNamesShort: ['Dom', 'Seg', 'Ter', 'Qua',
        'Qui', 'Sex', 'Sab'],

    defaultDate: new Date(),
    locale: 'pt-BR',
    header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,agendaWeek'
    },
    columnFormat: 'ddd',

So far everything is supimpa, but the only thing I’m not able to translate this way is the "Header Schedule" - The damned refuses to stay in English, and I could not find in the documentation/ on other sites a way to format only this property.

Here’s an image that shows what I mean:

inserir a descrição da imagem aqui

I want to translate that little part of Dec 31, 2017 - Jan 6, 2018 into Portuguese, and into the correct format, but as I said, the property Locale is not working.

Something else:

I am aware that the Locale property only works with language JS (en.js) being called correctly. It is properly referenced in the locale folder and in the Bundlescript used for this calendar.

inserir a descrição da imagem aqui

1 answer

0

Hello I did this way to translate everything

when unzipping the fullcalendar zip, you will have the address: fullcalendar/locale/en.js.

make the file call on the page in question

<script src='js/fullcalendar361/fullcalendar.js'></script>
<script src='js/fullcalendar361/locale/pt-br.js'></script>
<script src='js/fullcalendar361/lib/moment.min.js'></script>

$(document).ready(function() {

    $('#calendar').fullCalendar({
        // no script setar "pt-br"
        locale:  'pt-br',

I hope I’ve helped

  • Unfortunately, this was one of the first things I did and it didn’t work out, Wilson! Maybe it’s a problem with MVC, because if I do it in a separate file via Direct Script, it works. Thanks anyway!

  • I changed the code I made to include the calls of the scripts, you tried this way too?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.