What is the Accept-Language header and how is it used?

Answer

The Accept-Language request header indicates the client's preferred human language for the response. Example: Accept-Language: en-US,en;q=0.9,fr;q=0.8 — the client prefers American English, then any English, then French. The server uses this to return localized content: translated messages, locale-specific date formats, and currency symbols. APIs that support internationalization parse this header and return content in the preferred language. The q factor (quality value, 0.0–1.0) indicates preference priority. If the server does not support the requested language, it falls back to a default (usually English). This header enables the same API endpoint to serve content in multiple languages without requiring separate endpoints per locale.