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
- Tags follow BCP 47: a language (
de), optionally a region (de-CH) or a script (zh-Hant). qruns from0to1with at most three decimals. A tag without one hasq=1.q=0means "not acceptable".*stands for any language not listed.- Spaces after the commas are optional.
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
| Value | What it checks |
|---|---|
de-DE,de;q=0.9 | The plain case: a supported language is served. |
pt-BR | Region fallback: if you only have pt or pt-PT, does the server fall back to it or jump to the default? |
ja | An unsupported language: the default language should appear, not an error page. |
fr;q=0.5,en;q=0.8 | Order 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
- Click the HeaderDial icon to open the popup. If the site-access banner appears, choose Allow on all sites or Only <current host>.
- Click + Request header and type
Accept-Language(it is in the suggestions). Enter the list you want to send. - Leave the operation on set, which replaces the list the browser builds from its language settings.
- 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. - 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:
navigator.languageandnavigator.languageskeep their values. We confirmed this in the same test: the server received the new list whilenavigator.languagesstill readen-US,en.Intlformatters without an explicit locale, and client-side libraries that detect the language fromnavigator, keep using the real language.- A language cookie, a
/de/URL prefix or IP-based geolocation can take precedence over the header on the server.
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
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.- Cached language redirects. If
/redirects to/de/with301, browsers may remember the redirect and skip the server on later visits, whatever header you send. Language redirects should normally be302or307; while testing, use a private window or clear the cache. - A cookie from an earlier test. Many sites store the chosen language in a cookie after the first visit. Clear it, or use a fresh profile in a private window with HeaderDial allowed there.
- Invalid values. Servers parse this header in different ways. A typo such as
de_DE(underscore) is not a valid tag and may be ignored silently.
Add to ChromeFirefox: coming soon