HTTP Header Accept-Language
Desired languages for product content can only be set via the HTTP header Accept-Language, in the header of the request of an HTTP client (e.g. browser or application).
Web browser
For example, a browser may have the following information in the Accept-Language field:
de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
This would request the product content in German (de_de) and English (en_us).
Application via HTTP client
An HTTP application client can now also set analogous to the browser Accept-Language field, or can use ITscope internal language codes. These can be entered in a comma-separated format in order to obtain the product content in several languages.
ITscope API language codes
The ITscope API can interpret the following language codes:
- de – German
- en – English
- fr – French
- it – Italian
- es – Spanish
- nl – Dutch
As an example, the following value would be set in the HTTP Accept-Language header for English and French product content: ‘en, fr‘.
Content for all available languages can be retrieved with: ‘de, en, fr, nl, it, es‘.
Set content language via API for data formats
If no HTTP Header Accept-Language is specified, content in German is always returned as the default.
There are two sections in which texts, i.e. text content, are specified. At product level, this applies to data format standard and developer. And in the text content section, this only exists in the data format developer.
Rules for data format standard
In the standard data format, contents can only be retrieved in one language at a time. This means that the transfer of e.g. ‘fr,de‘ in the HTTP header Accept-Language would always only display the content in the language of the first language code. In our example, only content in French would be displayed.
In the standard data format, the specification of the Accept-Language HTTP header applies to content at product level.
Rules for data format developer
In the developer data format, content from the API element TextContent can be retrieved in all languages that are set via HTTP header Accept-Language. For example, if ‘de,en,fr‘ is set, the content in German, English and French can be found in the TextContent element. In the product section, however, the content is in German.
In the developer data format, the specification applies exclusively to the TextContent level. With the developer data format, the content at the product level always remains in the language that appears first in the HTTP header Accept-Language.
The TextContent is divided into several sections, e.g. language IDs for content, content providers, content categories and content tags. The correct text can then be determined on the basis of this data.
Set content language via export for data formats
For the export, the language(s) can be explicitly defined within the export definition, depending on the data format.
Rules for data format standard
In the standard data format, content can only be retrieved in one language at a time.
Rules for data format developer
In the developer data format, the specification applies exclusively to the TextContent level. With the developer data format, the content at the product level always remains in the language that is selected first.
The TextContent is divided into several sections, e.g. language IDs for content, content providers, content categories and content tags. The correct text can then be determined on the basis of this data.