React-big-calendar: how translate toolbar

Created on 18 Aug 2018  路  11Comments  路  Source: jquense/react-big-calendar

How translate toolbar ( today, month, week ....) ???

any examples?

Most helpful comment

As @jquense linked, pass an object with the month, day, week, etc values in the messages prop;

<BigCalendar
  localizer={localizer}
  events={[]}
  startAccessor="start"
  endAccessor="end"
  messages={{
    month: 'My month word',
    day: 'My day word',
    today: 'this day',
  }}
/>

You could also use an translation library to get the strings

import __ from 'i18next';

const messages = {
  month: __.t('Month');
  ...
}

<BigCalendar
  ...
  messages={messages}
/>

All 11 comments

The messages prop

@jquense i need example, in the document I found nothing about it

please read the documentation: http://intljusticemission.github.io/react-big-calendar/examples/index.html#prop-messages for things without examples the best bet is to browse the source to see how the props are used.

@jquense is posible translate the show more?

its possible to translate everything

@jquense is not possible in "show more", by type be function

yes it's possible. Please search past issues, and read the code. You'll have better luck getting the answers you need by doing a bit of preliminary work before opening issues. Small OSS projects don't often have a lot of time for providing support via the issue tracker. Please be respectful of their time and try to find the answer before opening new issues

My other solutions, I only open when I do not think so.

The document does not have enough examples. @jquense

As @jquense linked, pass an object with the month, day, week, etc values in the messages prop;

<BigCalendar
  localizer={localizer}
  events={[]}
  startAccessor="start"
  endAccessor="end"
  messages={{
    month: 'My month word',
    day: 'My day word',
    today: 'this day',
  }}
/>

You could also use an translation library to get the strings

import __ from 'i18next';

const messages = {
  month: __.t('Month');
  ...
}

<BigCalendar
  ...
  messages={messages}
/>

These are the messages I found can be set:

<Calendar
  localizer={localizer}
  events={[]}
  startAccessor="start"
  endAccessor="end"
  messages={{
                agenda: 'Agenda',
                allDay: 'Hele dag',
                month: 'Maand',
                day: 'Dag',
                today: 'Vandaag',
                previous: 'Terug',
                next: 'Volgende',
                date: 'Datum',
                noEventsInRange: 'Er zijn geen agenda-items in deze periode',
                time: 'Tijd',
                tomorrow: 'Morgen',
                week: 'Week',
                work_week: 'Werkweek',
                yesterday: 'Gisteren'
            }}
/>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

zhming0 picture zhming0  路  3Comments

jgautsch picture jgautsch  路  3Comments

tiaaaa123 picture tiaaaa123  路  4Comments

dogC76 picture dogC76  路  4Comments

KatiaPosPago picture KatiaPosPago  路  3Comments