This is the documentation for 2022-02-01.

Localization

Display

By default, a resource is presented in english. You can also display the resource in another language.

With the Accept-Language header a resource can be localized. However, this does not affect validation messages or any errors. These are still displayed in English.

The following locales are currently available for Accept-Language:

en, de, nl, fr, ar, sv, pl and tk

Saving

In some cases, you can also save a resource localized. For example, the Checkout Api uses this to save an order in a specified language. By default it is stored in english, using the Accept-Language header you can control how it is stored.

This is important if, for example, the delivery note is to be displayed in a specific language.

The localization of documents (e. g.: delivery note) cannot be regenerated afterwards.

Examples

Request for display a response with another language

Request

GET /variants/1 HTTP/1.1
Accept-Language: 'de'

Response

Content-Language: 'de'

{
    "id": 1,
    "option_values": [
        {
            "handle": "yellow",
            "name": "Gelb",
            "option_type": {
                "handle": "color",
                "name": "Farbe"
            }
        },
        ...
    ],
    ...
}

Request for saving a resources with another language

Request

POST /orders HTTP/1.1
Accept-Language: 'de'

{
    "email": "customer@example.com",
    "items": [
    {
        "variant_id": 1,
        "quantity": 1
    }],
    "shipping_address": {
        "first_name": "John",
        "last_name": "Doe",
        "street1": "123 Main St",
        "zip": "12345",
        "city": "Anytown",
        "country_code": "DE",
        "province_code": "NW",
        "phone": "12345 67890",
        "email": "shipping@example.com"
   }
}

Response

Content-Language: 'de'

{
    "id": 1,
    "external_identifier": null,
    "external_reference": null,
    "state": "incompleted",
    "customer_locale": "de",
    ...
}