Guides · Modelling

Locales

The languages a space publishes in, the default locale, fallback chains, localized fields, translating entries and how the delivery API picks a value for each locale.

5 min read

A space publishes in one or more locales, set under Settings → Languages. They apply to every environment of the space.

  • A locale has a code (en, nl, en-GB, zh-Hant-TW), a name, and optionally a locale it falls back to.
  • One is the default locale. Required fields must be filled in for it before an entry can be published, and every fallback chain ends there.
  • A space has up to 100 locales.

Localized fields

A field marked localized in the content model stores one value per locale:

{ "title": { "en": "About us", "nl": "Over ons" } }

Any other field holds one value shared by all locales. Asset alt text and titles are always per locale. In the entry editor, the language switch at the top picks which locale's values you edit.

Translating

The language switch shows how far each locale is: 3/5 means the entry has 5 localized values in the default locale, and 3 of them in this one (inside blocks too). A locale without a count has everything.

In another locale than the default, Translate from English (the default's name) fills in what that locale is missing by machine translation, with the same model as editing by prompt (Workers AI, or your space's prompt endpoint):

  • Text, long text and rich text are translated; rich text keeps its formatting, links and embeds. Other localized values (an image, an option, a number) are copied from the default locale.
  • Only empty values are filled. Once a locale is complete, Translate everything again overwrites it.
  • Nothing is saved: the translation lands in the form, to check and save like any edit. Fields, blocks and the other locales are never changed.

AI translation settings

Under Settings → Languages → AI translation, admins and developers decide for the whole space:

  • Allow AI translation: off removes the translate buttons, and the API refuses it (403 forbidden).
  • Into these languages: the locales it may write (all by default).
  • Instructions: house style the model follows on top of its own rules, such as “Use informal je in Dutch” or “Keep product names in English”. At most 2,000 characters.
  • Translate when the default language is saved: see below.

Many entries at once

Tick entries in the content list, press Translate, pick a language (or Every language) under Translate into and press Translate again. The translations run in the background, as you, within a few minutes; each is saved as the entry's draft, never published. The list shows how many are waiting, and what failed with why (a failure is retried three times). An entry someone has open with unsaved changes waits for them; an editor who has it open without changes gets the new draft right away.

Translating on save

With Translate when the default language is saved on, every save that changes the default language queues the same background translation for that entry: what changed is translated again in every other language, and whatever a language still lacks is filled in. Values edited by hand in another language stay as they are until their default-language text changes. Translations are saved as drafts, so review and publish them as usual (some languages at a time, if you like).

Agents

  • POST …/entries/{id}/translate with { "to": "nl", "overwrite"?, "save"? } translates one entry and returns its content; save: true saves it as the draft.
  • POST …/translations with { "entryIds": [...], "locales"? } queues many (202); GET …/translations lists what is waiting.
  • PATCH …/settings with { "translation": { "enabled"?, "locales"?, "instructions"?, "autoTranslate"? } } changes the settings.

Fallbacks

The delivery API answers one locale (?locale=nl; the default locale when left out). When a localized field is empty in that locale, it takes the value of the locale it falls back to, then that one's fallback, ending at the default locale.

With en as the default, nl-BE falling back to nl and nl to en:

RequestedTried, in order
nl-BEnl-BE, nl, en
nlnl, en
enen

?locale=* skips fallbacks and answers every localized field as { [locale]: value }.

URLs per locale

A page or folder has a slug per locale: the default locale's is required, the others are optional and fall back like field values, so every page has a path in every locale. Set them under Move in the entry's sidebar. With en as the default and a Dutch slug over-ons on /about-us, the delivery API answers /pages?path=over-ons&locale=nl, and every entry lists its paths. The locale itself is never part of the path: your site decides whether that is /nl/over-ons or nl.example.com/over-ons. See paths per locale.

Changing a slug keeps the old path as a redirect in that locale.

Changing locales

Adding locales, renaming them, and changing fallbacks or the default are possible at any time, and send a locales.changed webhook in every environment. A new default locale takes over its slugs: each page keeps its paths in the old and the new default. Paths that do change (a locale that fell back to the old default now falls back to the new one) become redirects.

Removing a locale

Remove… next to a saved locale (not the default: make another one the default first) deletes everything keyed by it, in every environment: its value in every localized field (drafts, published content and the trash), asset titles and alt text, slugs, paths and redirects. The dialog says how many entries, assets and slugs that touches, and asks you to type the code. Published content changes at once, sites asking for the locale get a 400 from then on, and a locales.changed webhook (with removed) goes out. Locales that fell back to it fall back to what it fell back to. Version history keeps what it had, so adding the locale again and restoring versions brings content back.

The prompt bar on your own site edits in the page's language, read from <html lang> when the space has that locale.

On this page

Marks in the margin

  • Note
  • Watch out
  • Updated

Scribes marked doubtful lines in the margin. That practice is called obelism.

Stuck on a step?