1. Negotiate the client’s preferred language

Most APIs with multilingual support allow clients to specify which natural languages are preferred using the Accept-Language HTTP header. For example, Accept-Language: fr, en means the client prefers French but will accept English. If no Accept-Language header is present, the API assumes that all languages are equally acceptable.

2. Respond with content in a preferred language

As demonstrated in the following subsection, in all except JSON formats, it is easy for an API to respond with content in all available languages and for clients to parse the content consistently, because there is a unique, standard approach to language tagging in those formats.

Until a unique, standard approach to language tagging emerges for JSON, to simplify the JSON response, if no Accept-Language header is present, the API should respond with content in the single, default language. If an Accept-Language header is present, it should respond with content in a preferred language where possible, and use the default language otherwise.

3. Indicate the language of a string