REST API national language support
The REST API supports, with certain qualifications, the ability to specify national languages as part of an HTTP request.
Background
HTTP headers allow particular behavior to be specified on requests and additional information to be provided in responses.
Included in the HTTP headers is the ability to request that information is returned in a national language. The REST API honors this header where possible.
Specify a national language
In the ACCEPT-LANGUAGE HTTP header, one or more language tags can be supplied. We can optionally associate a rank with the tags, allowing for the specification of a list ordered by preference. This page has a helpful discussion of the principle.
The REST API honors this header, selecting a language from the ACCEPT-LANGUAGE header and returning messages in that language. When the ACCEPT-LANGUAGE header contains no language that the REST API can support, messages are returned in a default language. This default language corresponds to the default locale of the REST API web server.
The What data is translated? section explains what data is translated.
Indicating the applicable language on responses
The CONTENT-LANGUAGE HTTP header on responses from the REST API indicates the language in which the messages are returned.
What data is translated?
Error and informational messages are translated, other text is not.
- Data that is returned from a queue manager is not translated - for example in the case of executing an MQSC command via the REST API, the queue manager's responses are in the locale of the queue manager.
- The generated (Swagger) documentation for the REST API, as exposed via the apiDiscovery feature, is in English.
What languages are supported?
In addition to English, REST API error and informational messages are translated into the following languages.
- Chinese(Simplified)
- Denoted by the language tag zh_CN
- Chinese(Traditional)
- Denoted by the language tag zh_TW
- Czech
- Denoted by the language tag cs
- French
- Denoted by the language tag fr
- Hungarian
- Denoted by the language tag hu
- Italian
- Denoted by the language tag it
- Japanese
- Denoted by the language tag ja
- Korean
- Denoted by the language tag ko
- Polish
- Denoted by the language tag pl
- (Brazilian) Portuguese
- Denoted by the language tag pt_BR
- Russian
- Denoted by the language tag ru
- Spanish
- Denoted by the language tag es
Examples
In the examples, the web server has an English default locale.
- Specify a single supported language
- In the request headers, ACCEPT-LANGUAGE is set to fr. This setting specifies that French is the preferred language for translatable text.
- Specify a list of languages
- In the request headers, ACCEPT-LANGUAGE is set to am, fr. This setting specifies that Amharic and French are acceptable languages for translatable text and that Amharic is the preferred language for translatable text.
- Specify a single unsupported language
- In the request headers, ACCEPT-LANGUAGE is set to am. This setting specifies that Amharic is the preferred language for translatable text.
Parent topic: Administration using the REST API