# i18n

> The i18n (internationalization) is the process of designing software so it can be adapted to different languages and regions.

## What is i18n?

The process of preparing an app for any language and region: moving texts out of the code, formatting dates, numbers and currencies by locale and supporting different scripts and text directions. Done once, it makes every new translation cheap.

- Topic: Internationalization
- Type: concept

## Example

Wrong:

```js
const label = 'You have ' + count + ' items';
const price = '$' + amount.toFixed(2);
```

Right:

```js
const label = t('cart.items', { count });
const price = new Intl.NumberFormat(locale, {
  style: 'currency',
  currency: 'USD',
}).format(amount);
```

Translation keys handle plural rules per language, and `Intl.NumberFormat` places the currency symbol and separators for the locale.

## Common mistakes

- Concatenating 'You have ' + n + ' items', which cannot be translated correctly.

## Key points

- No user-facing text is hardcoded in components: it comes from translation files.
- Dates, numbers and currencies are formatted with `Intl`, not by concatenating strings.
- Sentences are not built by gluing translated fragments together.

## Interview questions

### i18n vs l10n: what is the difference?

i18n prepares the code to support many languages and regions, while l10n translates and adapts the content for one specific locale.

### Why is internationalization shortened to i18n?

There are 18 letters between the first 'i' and the last 'n' in 'internationalization'.

### How do I support right-to-left languages?

Set `dir='rtl'` on `<html>` for those locales and use logical CSS properties like `margin-inline-start` instead of left and right.

## Related cards

- [l10n](https://wonderium.dev/web/l10n.md)
- [Locale](https://wonderium.dev/web/locale.md)
- [Intl](https://wonderium.dev/js/intl.md)
- [ICU Message Format](https://wonderium.dev/web/icu-message-format.md)

---

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