Skip to content

locale

The BCP 47 language the calendar’s words, dates and numbers are written in.

Typestring
Defaultthe page's language (<html lang>), else 'en'
Live update (update())Yes
Declared inpackages/core/src/kernel.ts

locale decides how dates and times are written (21 oct., Oct 21), the calendar’s own words (the buttons, “+N more”, the menus), and the week’s conventions when firstDay is not given: the first day of the week and how weeks are numbered.

English and French words are built in. Arabic, Spanish and German are one import each (import '@dzcalendar/dom/locales/ar', /es, /de); another language takes its words from messages or defineLocale. A locale whose words are not loaded is still written by the platform — dates and numbers in that language — with the English words. Left out, the page’s language (<html lang>) is used, then 'en'.

import { createCalendar } from '@dzcalendar/dom';
import '@dzcalendar/dom/locales/de';
const calendar = createCalendar(element, { timeZone: 'Europe/Berlin', locale: 'de-DE' });
// Later: French, built in.
calendar.update({ locale: 'fr-FR' });

In the frameworks it is an input: Angular’s locale, React’s locale, Vue’s locale.

The same week, its dates, hours and buttons in French.