Skip to content

locale

How the cells write numbers and dates, and how text sorts — apart from the language of the texts.

Typestring
Defaultthe bundle’s language (messages.locale)
Live update (update())Yes
Angularthe [locale] input
<dz-grid>the locale attribute
Declared inpackages/dom/src/settings.ts

A language tag ('en-GB', 'fr-CH', 'ar-DZ'): 1 234,5 or 1,234.5, 03/02/2026 or 2026-03-02, and the order of « é » among the other letters when a text column is sorted. Left out, the grid takes the messages bundle’s locale — so English texts with Swiss numbers are messages: EN, locale: 'de-CH'.

The calendar is always the Gregorian one, whatever the tag says, and the digits are Latin unless numerals asks for the language’s own. A malformed tag throws a RangeError: from createGrid, or from update(), which then leaves the grid as it was. The <dz-grid> attribute does not throw: it leaves the value out and tells an invalid-setting warning.

import { createGrid } from '@dzgrid/dom';
import { EN } from '@dzgrid/dom/locales/en';
type Cheese = { id: string; name: string; price: number; aged: string };
const grid = createGrid<Cheese>(document.getElementById('cheeses')!, {
rows: [{ id: 'c1', name: 'Mountain wheel', price: 1234.5, aged: '2025-11-02' }],
columns: [
{ id: 'name', header: 'Cheese' },
{ id: 'price', header: 'Price', type: 'number' },
{ id: 'aged', header: 'Aged since', type: 'day' },
],
getRowId: (c) => c.id,
messages: EN,
locale: 'de-CH',
});
grid.update({ locale: 'en-GB' });

English texts, Swiss numbers and dates (de-CH).

  • numerals — the language’s own digits.
  • timeZone — the zone instants are shown in.
  • messages — the texts’ language.