# Locales

Add languages to a project, read and write each entry per locale, and choose what the API serves when a translation is missing.

A locale is a language a project's content can be written in, named by a code such as `en-gb` or `fr-fr`. Every project starts with one, `en-gb`, as its default. Add more when a site needs another language. Each entry then holds its own content for each locale, on the same content type and the same fields.

## Add a locale

Open the project's **Settings** and find **Locales**. Give the locale a code and a name, then choose **Add locale**. You need to be an admin or owner of the project.

A code is two letters, or two letters, a hyphen and two more: `fr` or `fr-fr`. It is saved in lower case.

The default locale is the one the project was created with. It is what the API serves when a request names no locale, and it cannot be removed. There is no setting to make a different locale the default.

## One entry, a version per locale

An entry has one `id` and one `uid`, whatever the language. Its field values are kept per locale, and each locale is saved, published and unpublished on its own. An entry can be live in English, a draft in French and not exist in German at all.

Once a project has more than one locale, the entry editor shows a locale switcher at the top.

> **Note:** The `uid` is shared by every locale. Saving or publishing a locale with a different value in the slug field changes the `uid` for all of them, so do not translate the slug field.

## Read a locale with lang

Add `lang` to a Delivery API request. Leave it out and you get the default locale.

```bash
curl "https://mojimoto.com/api/v1/acme/documents?type=post&lang=fr-fr" \
  -H "Authorization: Bearer mjmt_your_read_token"
```

```json
{
  "results": [
    {
      "id": 42,
      "uid": "pain",
      "type": "post",
      "lang": "fr-fr",
      "status": "published",
      "published_at": "2026-11-26T09:14:02+00:00",
      "updated_at": "2026-11-26T09:14:02+00:00",
      "data": { "title": "Pain" }
    }
  ],
  "page": 1,
  "per_page": 20,
  "total_results": 1,
  "total_pages": 1,
  "lang": "fr-fr",
  "ref": "published"
}
```

The `lang` at the bottom is the locale you asked for. The `lang` on each entry is the locale that entry is in.

### What a missing translation returns

An entry that has nothing published in the locale you ask for is left out of a list, and `total_results` does not count it. Asked for by id, it is a `404`:

```json
{ "message": "No content for that locale." }
```

That is the behaviour until the locale is given a fallback.

## Write a locale with lang

On the Management API, `lang` goes in the request body. Leave it out and the write goes to the default locale.

```bash
curl -X PUT "https://mojimoto.com/api/v1/acme/manage/documents/42" \
  -H "Authorization: Bearer mjmt_your_write_token" \
  -H "Content-Type: application/json" \
  -d '{"lang": "fr-fr", "data": {"title": "Pain"}}'
```

`lang` has to be a locale the project already has. Upper or lower case does not matter. Anything else is a `422`, and nothing is written:

```json
{
  "message": "This project has no locale \"de-de\". It has: en-gb, fr-fr. Add it under Settings, Locales, then write to it.",
  "errors": {
    "lang": ["This project has no locale \"de-de\". It has: en-gb, fr-fr. Add it under Settings, Locales, then write to it."]
  }
}
```

The MCP tools follow the same rule. The endpoints that take `lang` are listed in the [Management API](/docs/api/management) reference.

## Fall back to another locale

A locale can fall back to another. In **Settings**, under **Locales**, each locale has a menu that reads **No fallback** until you pick one. A fallback can have a fallback of its own: Canadian French to French, and French to English.

It is off until you choose it, so an existing site keeps the behaviour above. Once `fr-ca` falls back to `fr-fr`, a request for `lang=fr-ca` changes in two ways.

- **Untranslated entries are served from the fallback.** An entry with nothing published in `fr-ca` comes back in `fr-fr`, or in the next locale along if French has nothing either. If no locale in the chain has it, it is still left out, or a `404` by id.
- **Empty fields are filled from the fallback.** If the `fr-ca` version leaves a field empty, that one field is served from `fr-fr`. Empty means `null`, `""` or `[]`. `false` and `0` are values and are kept.

Each entry's `lang` says where it came from. Three posts asked for in `fr-ca`, one translated, one only in French and one only in English, come back as:

```json
{
  "results": [
    { "uid": "a-canadian", "lang": "fr-ca", "data": { "title": "Allo" } },
    { "uid": "b-french", "lang": "fr-fr", "data": { "title": "Pain" } },
    { "uid": "c-english", "lang": "en-gb", "data": { "title": "Cake" } }
  ],
  "total_results": 3,
  "lang": "fr-ca"
}
```

The other keys are left out here to keep it short. An entry served in its own locale with some fields filled in from a fallback keeps its own `lang`.

Linked entries follow the same chain, and `fields.*` filters and sorts see the values as they are served. Published requests only ever fill from what the fallback has published, never from its drafts.

### Publish a translation that leaves required fields to its fallback

Publishing checks an entry as it will be served. A translation can leave a required field empty if a locale it falls back to has published a value for it. If none has, publishing fails as usual, for example with `Title is required.`

## How many locales each plan includes

| Plan | Locales |
| --- | --- |
| Free | 2 |
| Starter | 3 |
| Pro | 10 |
| Enterprise | No limit |

The default locale counts as one. A project at its limit cannot add another until it moves up a plan or removes one. See [Technical limits](/docs/technical-limits).
