Accept-Language is an HTTP request header that lets clients express preferred languages for human-facing API data and error messages. APIs can make it optional and use a default such as English. section 9.7.2
When adapting responses, keep consumer applications’ machine-readable inputs stable:
- Translate human-facing labels, but not property names or codes that consuming applications use. section 9.7.2
- Support language variants such as fr-FR and fr-CA; q-values let clients rank preferences and indicate acceptable fallbacks. section 9.7.2
- Use the preferred language for informative error messages. APIs usually leave string formatting to consumers, though an API returning a PDF may format amounts itself. section 9.7.2 section 9.8.3
Requesting transaction labels
A client can send Accept-Language: fr to receive a French label such as “Agence de voyage” while the category code remains travel_agency. Accept-Language: fr;q=0.9, it;q=0.8, *;q=0.5 prefers French, then Italian, and accepts any language otherwise. section 9.7.2
