ProSchedulerSign in

Scheduler · Localization & lifecycle

Localization

Six built-in locales: dates format through Intl, and the first day of the week and every label follow the locale.

Live demo

Switch languages · Open the length select in German

Fullscreen
import { useState } from "react"
import { localeDe, localeEn, localeEs, localeFr, localePtBr, localePtPt, ProScheduler, type SchedulerLocale } from "@andreisaac/pro-scheduler"
import { studioResources, studioSessions } from "./data/studio"
import { Choice, Toolbar, useEvents } from "./kit"

const languages: [string, SchedulerLocale][] = [
  ["English", localeEn],
  ["Français", localeFr],
  ["Deutsch", localeDe],
  ["Español", localeEs],
  ["Português (BR)", localePtBr],
  ["Português (PT)", localePtPt],
]

export function LocalizationDemo() {
  const { events, handlers } = useEvents(studioSessions)
  const [language, setLanguage] = useState(1)

  return (
    <div className="docs-demo__stack">
      <Toolbar label="Language">
        {languages.map(([name], i) => (
          <Choice key={name} active={language === i} onClick={() => setLanguage(i)}>
            {name}
          </Choice>
        ))}
      </Toolbar>
      <ProScheduler
        data={events}
        resources={studioResources}
        locale={languages[language][1]}
        view={{ scheduler: { type: "week", startTime: "07:00", endTime: "20:00" }, agenda: { type: "week" } }}
        height={560}
        {...handlers}
      />
    </div>
  )
}

About this demo

Six built-in locales: dates format through Intl, and the first day of the week and every label follow the locale.

Things to try

  • Switch languages
  • Open the length select in German

The props behind it are explained in Localization.

Use ProScheduler in your project