Leaving Fullcalendar in the English language

Asked

Viewed 19,149 times

15

Hello, I downloaded a template fullcalendar of Adan Shaw, only that the standard language is English, I would like to leave it in Portuguese. How do I make this change? Thank you.

  • Hello @Thiagoferreira Welcome to Stackoverflow. There is some code where we can base ourselves for the solution of your problem?

3 answers

15

Inside the folder you downloaded from fullcalendar, you have the lang subfolder that contains all languages supported by fullcalendar

pasta 1

pasta 2

Copy the javascript pt-br.js and include in your project.

Your headline 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.

  • Gustavo this would be my answer, however, for a more complete answer add the way to add in the project preferably with examples. It’s easier for AP to understand and a full answer will earn you more points. ;)

  • Yeah, take this js and play where, in the documentation does not say where right.

  • 1

    OK @Pedro, edited! In the case of Thiago, you must include the . js within the path of your project and include by the <script src='seu_path/en.js'></script>

  • The en is already in my project, like all languages, I can view the . js file in my project in the lang folder. Only I’m not using it. I couldn’t locate this header Gustavo.

  • This script goes in the fullcalendar.css file ?

  • This script goes on your page that will be displayed the calendar. How did you make fullcalendar work? It will be the same way to make the other js work.

  • So Gustavo, by the code described above, I believe it will be in some . css, I deduce this because of the <script tag>

  • I intend to mark an answer, no one???

  • +1. It worked for me.

Show 4 more comments

12

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: "&nbsp;&#9668;&nbsp;",
        next: "&nbsp;&#9658;&nbsp;",
        prevYear: "&nbsp;&lt;&lt;&nbsp;",
        nextYear: "&nbsp;&gt;&gt;&nbsp;",
        today: "Hoje",
        month: "Mês",
        week: "Semana",
        day: "Dia"
    }
});
  • Oloco in hand, would not exchange the 'en' for 'en' only?

  • And if you want something custom or even don’t have the "en" reference. You’ll have to download this file the same way. That I explain how the translation of Fullcalendar works. ;)

1

It is possible to set the property locale for pt-br.

But even by changing the locale, I needed 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 the 'locale': https://fullcalendar.io/docs/locale

Browser other questions tagged

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