Skip to content

Locale & i18n

trud-calendar supports full internationalization through two mechanisms:

  1. Date formatting — via the native Intl API (no moment/date-fns)
  2. UI labels — via the CalendarLabels system

Pass a BCP 47 locale string:

<Calendar
events={events}
locale={{
locale: "es-ES",
weekStartsOn: 1, // Monday
}}
/>

This automatically translates all date-derived text: month names, weekday headers, time formatting, toolbar title, etc.

ValueDay
0Sunday (default)
1Monday
2Tuesday
3Wednesday
4Thursday
5Friday
6Saturday

Button text and view names are not locale-derived — they need explicit translations. Provide them via locale.labels:

<Calendar
events={events}
locale={{
locale: "es-ES",
weekStartsOn: 1,
labels: {
today: "Hoy",
month: "Mes",
week: "Semana",
day: "Dia",
agenda: "Agenda",
allDay: "todo el dia",
noEvents: "No hay eventos en este periodo",
more: (n) => `+${n} mas`,
},
}}
/>
interface CalendarLabels {
today: string; // "Today" button
month: string; // Month view tab
week: string; // Week view tab
day: string; // Day view tab
agenda: string; // Agenda view tab
allDay: string; // "all-day" label in week/day view
noEvents: string; // Empty state text in agenda view
more: (count: number) => string; // "+N more" button in month view
}

You only need to provide the labels you want to change — the rest fall back to English defaults:

// Only translate the view tabs
<Calendar
events={events}
locale={{
locale: "fr-FR",
labels: {
today: "Aujourd'hui",
month: "Mois",
week: "Semaine",
day: "Jour",
},
}}
/>
const spanishConfig = {
locale: "es-ES",
weekStartsOn: 1 as const,
labels: {
today: "Hoy",
month: "Mes",
week: "Semana",
day: "Dia",
agenda: "Agenda",
allDay: "todo el dia",
noEvents: "No hay eventos en este periodo",
more: (n: number) => `+${n} mas`,
},
};
<Calendar events={events} locale={spanishConfig} />