locale
The BCP 47 language the calendar’s words, dates and numbers are written in.
| Type | string |
|---|---|
| Default | the page's language (<html lang>), else 'en' |
Live update (update()) | Yes |
| Declared in | packages/core/src/kernel.ts |
What it does
Section titled “What it does”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'.
Example
Section titled “Example”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' });import { Component } from '@angular/core';import { DZ_CALENDAR } from '@dzcalendar/angular';import '@dzcalendar/dom/locales/ar';
@Component({ selector: 'app-agenda', imports: [DZ_CALENDAR], template: `<dz-calendar timeZone="Asia/Riyadh" locale="ar-SA" />`,})export class Agenda {}import { DzCalendar } from '@dzcalendar/react';import '@dzcalendar/dom/locales/es';
export function Agenda() { return <DzCalendar timeZone="Europe/Madrid" locale="es-ES" />;}<script setup lang="ts">import { DzCalendar } from '@dzcalendar/vue';</script>
<template> <DzCalendar time-zone="Europe/Paris" locale="fr-FR" /></template>In the frameworks it is an input: Angular’s locale, React’s locale, Vue’s locale.
Live demo
Section titled “Live demo”The same week, its dates, hours and buttons in French.
See also
Section titled “See also”firstDay— the week’s first day, the locale’s by default.titleFormat— how the title is written.- Languages.