Skip to content

Localization

One setting localizes everything: the adapter’s locale. It drives month and weekday names, date and time formats, the first day of the week and the interface text.

Result· switch the language
import { ru } from "date-fns/locale/ru";
<DateLocalizationProvider adapter={new DateFnsAdapter({ locale: ru })}>

The visible words (“Today”, “Day”, “Week”, “Month”) come from the browser’s Intl data, so every locale gets them. The screen-reader labels of the navigation buttons, the view list and the buttons to hidden events, and the “+3 more” label have built-in translations for English, Russian, Ukrainian, German, French, Spanish, Portuguese, Italian, Dutch, Polish, Turkish, Chinese, Japanese and Korean.

Switching the adapter re-renders the calendar in the new language and keeps the visible period.

<DateLocalizationProvider adapter={ptAdapter} messages={{
today: "Hoje", day: "Dia", week: "Semana", month: "Mês",
previous: "Anterior", next: "Próximo", chooseDate: "Escolher data",
previousMonth: "Mês anterior", nextMonth: "Próximo mês", chooseView: "Visualização",
more: (count) => `+${count} mais`,
earlier: (count) => `Eventos anteriores: ${count}`,
later: (count) => `Eventos posteriores: ${count}`,
}}>

In the DOM package pass messages as an option: calendar.update({ messages: { today: "Now" } }). useMessages() returns the resolved strings for your own React components.

The first day of the week comes from the locale; override it with startWeek (0 is Sunday).