# CLDR

> The CLDR (Common Locale Data Repository) is a database of locale data used by `Intl` and i18n libraries.

## What is CLDR?

The Unicode database with locale rules: date and number formats, currency symbols, plural rules, language and country names. Browsers use it for `Intl`, so apps get correct formats without maintaining their own tables.

- Topic: Internationalization
- Type: concept

## Example

Wrong:

```js
const days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
const label = days[(date.getDay() + 6) % 7];
```

Right:

```js
const format = new Intl.DateTimeFormat(locale, { weekday: 'short' });
const label = format.format(date);
```

`Intl` takes weekday names from CLDR data, so the label is correct in every locale without hand-made tables.

## Common mistakes

- Hardcoding month names, currency symbols or date patterns for each language.
- Assuming the week starts on the same day in every region.
- Comparing formatted `Intl` output in tests, which changes when CLDR data updates.

## Key points

- Country, language and currency names come from `Intl.DisplayNames`, not from a handwritten list.
- Formats come from `Intl` APIs instead of hardcoded patterns like 'MM/DD/YYYY'.

## Interview questions

### What is the difference between CLDR and ICU?

CLDR is the data: formats, names and rules per locale. ICU is a library that implements formatting and collation using that data.

### Why does Intl output differ between browsers?

Engines ship different CLDR data releases and locale sets, so spacing, abbreviations or punctuation can differ slightly.

### Do I need to bundle CLDR data in my app?

Usually not in the browser, because `Intl` already includes it. Bundle data only for features `Intl` lacks.

## Related cards

- [Intl](https://wonderium.dev/js/intl.md)
- [Intl.DisplayNames](https://wonderium.dev/js/intl-display-names.md)
- [Unicode](https://wonderium.dev/web/unicode.md)

---

- Level: [Web Platform](https://wonderium.dev/web.md)
- HTML version: https://wonderium.dev/web/cldr
- Last updated: 2026-11-25
