# Localization

fulfillmenttools supports localization, enabling data management in multiple languages. This article explains how to change user and platform locales, request specific languages, and handle localized entity fields.

## Supported languages

We currently support 16 languages, including English, Spanish, French, German, and more. The list of supported languages can be retrieved via API:

```http
GET https://{projectId}.api.fulfillmenttools.com/api/configurations/supportedlocales
```

## Usage

Many entities already support localization. The system automatically applies the target language in responses.

For example, article titles require translations during creation:

```json
"titleLocalized": {
    "en_US": "This is a very nice title",
    "de_DE": "Dies ist ein sehr schöner Titel",
    "fr_FR": "Ce titre est très sympa"
}
```

**Validation rules for localized objects:**

* Must contain at least one entry
* Keys must be valid locale codes (for example, `en_US`) adhering to the ISO 639 language code (for example, `en`) and the ISO 3166-1 country code (for example, `US`).
* Values must have a minimum length of 1

When requested via the REST API, the `title` field is automatically filled with the appropriate translation. For a German user, the response is:

```json
"title": "Dies ist ein sehr schöner Titel",
"titleLocalized": {
    "de_DE": "Dies ist ein sehr schöner Titel",
    "en_US": "This is a very nice title",
    "fr_FR": "Ce titre est très sympa"   
}
```

## Request a specific language

Language selection can be controlled in three ways:

* **User locale**: Defined in the user object and included in the Bearer token.
* **Request locale**: Specified with the `locale` query parameter.
* **Localized field**: The `*Localized` field always contains all translations.

## Fallback language

If the requested language is unavailable, the system applies the following fallback order:

1. Language defined in user settings
2. Default platform language
3. English
4. First available language for the entity
5. Non-localized field value (legacy entities only)

## Change user locale

Refer to the [Users API documentation](https://fulfillmenttools.github.io/fulfillmenttools-api-reference-ui/#post-/api/users/search) for details.

To change a user's locale, send a `PATCH` request with the new locale. After updating, refresh the authentication token to apply the change.

```http
PATCH https://{projectId}.api.fulfillmenttools.com/api/users/{userId}
```

```json
{
    "actions": [
        {
            "action": "ModifyUser",
            "locale": "de_DE"
        }
    ],
    "version": 2
}
```

## Change default platform locale

Refer to the [Configurations API documentation ](https://fulfillmenttools.github.io/fulfillmenttools-api-reference-ui/#get-/api/configurations/locale)for details.

The default platform locale defines the standard language for the entire platform. Update it with a `PUT` request:

```http
PUT https://{projectId}.api.fulfillmenttools.com/api/configurations/locale
```

```json
{
    "locale": "de_DE",
    "version": 42,
    ...
}
```
