HeaderDial › Guides

How to test localisation with the Accept-Language header

To see your site the way a German, Brazilian or Japanese visitor's browser asks for it, set the Accept-Language request header in Chrome, Edge or Firefox. In HeaderDial, add a request header named Accept-Language with a value such as de-DE,de;q=0.9,en;q=0.5, leave it on set and limit it to your site. Server-side language negotiation sees the new value at once. JavaScript does not: navigator.language keeps reporting the browser's real language.

How the header is written

The value is a comma-separated list of language tags, each with an optional weight called a q-value:

Accept-Language: de-CH, de;q=0.9, fr;q=0.6, en;q=0.4, *;q=0.1

The server compares this list with the languages it has, picks the best match and should answer with Content-Language naming the language it chose. If the response varies by language, it should also send Vary: Accept-Language so that caches keep one copy per language.

Test cases worth trying

ValueWhat it checks
de-DE,de;q=0.9The plain case: a supported language is served.
pt-BRRegion fallback: if you only have pt or pt-PT, does the server fall back to it or jump to the default?
jaAn unsupported language: the default language should appear, not an error page.
fr;q=0.5,en;q=0.8Order versus weight: q-values decide, not the order in the list, so English should win.
*Wildcard only: the server should use its default.

To test a browser that expresses no preference at all, remove the header instead; see how to remove a request header.

Steps

  1. Click the HeaderDial icon to open the popup. If the site-access banner appears, choose Allow on all sites or Only <current host>.
  2. Click + Request header and type Accept-Language (it is in the suggestions). Enter the list you want to send.
  3. Leave the operation on set, which replaces the list the browser builds from its language settings.
  4. Open Where it applies, click + Only on…, choose Domain and enter your host, for example www.example.com. Every other site keeps your normal language.
  5. Make one profile per locale with + next to the profile chips, name them ("de-DE", "pt-BR", "ja") and switch between them with each profile's Active switch. If two active profiles set the header, the leftmost chip wins.

Set or append

Accept-Language is one of the request headers browsers allow extensions to append to. append adds your entry after the browser's own list. In our test (Chrome 159 and Firefox 158, HeaderDial 0.1.0, browser language English), appending fr;q=0.1 produced en-US,en;q=0.9, fr;q=0.1. That is handy for adding a low-priority fallback, but the result depends on each tester's browser settings. For repeatable tests, use set.

What the header does not change

The header changes what servers receive. It does not change the browser's language settings, so anything decided in the page itself stays the same:

To test client-side detection, change the browser's own language list instead: in Chrome and Edge under Settings › Languages, in Firefox under Settings › General › Language › Choose. That changes both the header and navigator.languages, but for every site.

The curl equivalent

curl -s -o /dev/null -D - -H "Accept-Language: de-DE,de;q=0.9,en;q=0.5" \
  https://www.example.com/ | grep -i -E '^(content-language|vary|location):'

Checking the response headers this way shows which language was chosen and whether the server sent Vary: Accept-Language and any redirect.

Pitfalls

If a page is cached without Vary: Accept-Language, a CDN or the browser can serve the language of whoever requested it first. Testing several locales against the same URL is a good way to catch exactly that bug, but it also means a cached result can look like a negotiation failure. See testing with Cache-Control to rule caching out.

Add to ChromeFirefox: coming soon