# Pages in the user's language

> Sign-in prompts and consent pages in English, French or German, chosen from the user's browser, with your own wording for any message and any language you add.

The realm shows its sign-in prompts in the user's own language, read from their browser. English, French and German
are included. You can change any message's wording for your realm, add a language the realm doesn't include, or
limit the languages your realm offers.

## Before you begin

- **Who can do it:** a realm administrator, in a group that holds `RealmOwner`
  ([Delegated administration](/platform/realms/delegated-administration/)).
- **Where:** today messages are set through the API ([Call the API](/develop/api/) shows how to get
  `$CVYUH_SESSION`).

## How it works

Each prompt is a message with a key, such as `nativeStore.username` for the username label. When a page is shown, the
realm picks the best match for the browser's `Accept-Language` among the languages it offers, and falls back to the
deployment's default language.

Your realm's changes live in one object, `i18nBundle`, layered over the included messages one key at a time. A realm
that changed nothing has none.

- `bundles` holds your wording, as namespace, then language, then message key. Sign-in prompts are in the `authn`
  namespace; the consent page's scope labels are in `oauth2` (see [Consent](../../../customer-identity/consent/)).
- `locales` limits the languages your realm offers, as BCP 47 tags. Leave it out to offer every language the realm
  includes, including ones added later.

Messages use the Fluent format, so a message can fill in a value or change with a number, such as the attempts left
before [lockout](../lockout/).

## Set it up

Change one message in English, and add Spanish wording for it:

```sh
curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/i18nBundle/i18nBundle \
  -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
  -H "Content-Type: application/json" \
  -d '{ "bundles": {
      "authn": {
        "en": { "nativeStore.username": "Work email" },
        "es": { "nativeStore.username": "Correo de trabajo" }
      }
  } }'
```

## What the user sees

The sign-in page in the language their browser asks for first, among those the realm offers: prompts, buttons, the
lockout warning, and the consent page's scope labels. Sign-in refusals (a locked or deactivated account) are in
English only today.

## Limits and defaults

| Setting or limit | Default | Range |
|---|---|---|
| Included languages | English, French, German | |
| `locales`: languages offered | every included language, and any you add | BCP 47 tags |
| A message | one line | a multi-line message is skipped |

## Troubleshooting

| Symptom | Cause | Fix |
|---|---|---|
| Your wording doesn't show | The message spans lines, or the key is misspelled | Keep it to one line, and check the key's spelling |
| A user sees English | Their browser asks for a language the realm doesn't offer | Add the language, or list it in `locales` |

## Audit record

A change to `i18nBundle` is recorded as `CREATED`, `UPDATED` or `PATCHED` in **Audit → Config**
([Change history](/audit-reports/audit-trail/change-history/)).

## Good to know

- **Change only what you need.** A key you don't set keeps the included wording, so a realm can change one message
  without restating a whole language.
- **A language you add can be partial.** A message it doesn't hold is shown in the fallback language.
- **The fallback language is always offered,** whether or not `locales` lists it.
- **Keep messages to one line.** A multi-line message set here is skipped, and the included wording is shown.

## Related

- [Sign-in methods](../sign-in-methods/): the prompts each method shows.
- [Consent](../../../customer-identity/consent/): the consent page's labels, set the same way.
