To screenshot a site the way a reader in Berlin or Tokyo sees it, a headless browser has to change three separate things. The first is the Accept-Language header the server reads. The second is navigator.language, which scripts read. The third is the locale and time zone that Intl uses to format dates, numbers and currencies. In Playwright, the locale and timezoneId context options set all three. In Puppeteer, no single setting does: we tested seven ways, and only a combination of two DevTools Protocol calls and page.emulateTimezone() changed everything. The usual launch flag, --lang, changed nothing in Chrome's current headless mode on macOS or on Linux.
This guide shows what we measured, the code that worked, and what changed when we captured one real site in five locales.
The three signals a page can read
A site can decide its language and formats in three places, and different sites use different ones:
| Signal | Who reads it | What it decides |
|---|
Accept-Language request header | The server | Which language version it sends or redirects to |
navigator.language and navigator.languages | Page scripts | Client-side language pickers and translations |
The Intl locale and the time zone | toLocaleString(), Intl.DateTimeFormat, Intl.NumberFormat | Date order, decimal separators, currency position, clock time |
MDN describes Accept-Language as a hint that browsers fill from the user's interface language, and says it generally lists the same locales as navigator.languages, with decreasing q values. MDN also notes that the header is often outside the user's control, for example when travelling. A screenshot test has to set the header and the scripts' view together, or the server and the page disagree.
How we tested
We wrote a small local page that prints every signal: navigator.language, navigator.languages, the Intl locale and time zone, a fixed moment (14:30 UTC on 3 November 2026) formatted with toLocaleString(), a number, a euro amount and Date.toString(). A local Node server logged the Accept-Language header of the page request and of a fetch() the page made. Then we opened the page with each setting on its own, aiming for German (de-DE) and Berlin time, on a Mac whose system locale is British English.
What each setting changed
| Setting (Puppeteer unless stated) | Header | navigator.language | Intl formats | Time zone |
|---|
| Nothing (defaults) | en-GB,en;q=0.9 | en-GB | en-GB | Europe/London |
--lang=de-DE launch flag | unchanged | unchanged | unchanged | unchanged |
LANG=de_DE.UTF-8 environment variable | unchanged | unchanged | unchanged | unchanged |
--accept-lang=de-DE,de launch flag | de-DE,de;q=0.9 | de-DE | unchanged | unchanged |
page.setExtraHTTPHeaders() with Accept-Language | de-DE,de;q=0.9 | unchanged | unchanged | unchanged |
CDP Emulation.setUserAgentOverride with acceptLanguage | de-DE,de;q=0.9 | de-DE | unchanged | unchanged |
CDP Emulation.setLocaleOverride with de_DE | unchanged | unchanged | de-DE | unchanged |
page.emulateTimezone("Europe/Berlin") | unchanged | unchanged | unchanged | Europe/Berlin |
| The last three together | de-DE,de;q=0.9 | de-DE | de-DE | Europe/Berlin |
Playwright locale: "de-DE", timezoneId: "Europe/Berlin" | de-DE | de-DE | de-DE | Europe/Berlin |
Four results are worth knowing before you write a test:
- Setting a header is not enough.
setExtraHTTPHeaders() changed what the server saw, on the page request and on the page's own fetch(), but scripts still read en-GB, and the euro amount still printed as €1,234.50. A page that localizes in JavaScript stays English.
- The locale override does not touch the network.
Emulation.setLocaleOverride switched every Intl result to German (1.234.567,891, 1.234,50 €, 3.11.2026, 14:30:00) and even translated the time-zone name in Date.toString() to Mittlere Greenwich-Zeit. But the header and navigator.language stayed English. The protocol documentation marks this command as experimental.
- The time zone moves the clock, not the language. With only
emulateTimezone(), the same moment printed as 15:30 with GMT+0100, still in British format.
- The native date picker ignored every override. The
<input type="date"> on the probe page showed 03/11/2026, the Mac's own British format, in all eight captures we made, including Playwright's German one. Don't use form controls to check that a locale was applied.

Why the --lang flag didn't work
Many older answers say to launch Chrome with --lang. In our tests it had no effect in Chrome's current headless mode, which Puppeteer uses by default, on either system:
- macOS, Chrome for Testing 156:
--lang=de-DE and LANG=de_DE.UTF-8 changed nothing. In the older chrome-headless-shell build (Puppeteer's headless: "shell"), --lang=de-DE did switch navigator.language and Intl to German, but the page request then carried no Accept-Language header at all.
- Debian 12, Chromium 155 in Docker: nothing changed, because the image held a single locale file,
en-US.pak. After we installed Debian's chromium-l10n package (440 files in Chromium's locales folder; the install also upgraded Chromium to 156.0.8078.73), LANG=de_DE.UTF-8 worked. It set the header to de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7 and navigator.language to de-DE. --lang still did nothing. The time zone stayed UTC, the container's own.
So a locale set through the environment depends on the operating system, the installed packages and the headless mode. The protocol calls below gave the same result on every setup we tried, so set the locale per page.
The Puppeteer recipe
This helper sets all three signals on one page. We ran it against mozilla.org with Japanese and Tokyo time:
import puppeteer from "puppeteer";
async function localize(page, { locale, timezoneId }) {
const cdp = await page.createCDPSession();
const language = locale.split("-")[0];
await cdp.send("Emulation.setUserAgentOverride", {
userAgent: await page.browser().userAgent(),
acceptLanguage: `${locale},${language}`,
});
await cdp.send("Emulation.setLocaleOverride", { locale: locale.replace("-", "_") });
await page.emulateTimezone(timezoneId);
}
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 800 });
await localize(page, { locale: "ja-JP", timezoneId: "Asia/Tokyo" });
await page.goto("https://www.mozilla.org/", { waitUntil: "load" });
console.log(page.url());
console.log(await page.evaluate(() => [
navigator.language,
Intl.DateTimeFormat().resolvedOptions().locale,
Intl.DateTimeFormat().resolvedOptions().timeZone,
new Date(Date.UTC(2026, 10, 3, 14, 30)).toLocaleString(),
]));
await page.screenshot({ path: "recipe-ja-JP.png" });
await browser.close();
Output:
https:
[ 'ja-JP', 'ja-JP', 'Asia/Tokyo', '2026/11/3 23:30:00' ]
Call localize() before page.goto(), because the server reads the header on the first request. setLocaleOverride takes an ICU-style locale with an underscore (ja_JP), and emulateTimezone() takes an IANA name such as Asia/Tokyo. Puppeteer's documentation points to ICU's list of supported IDs.
The order matters for real sites, too. When we set only the Intl locale to German, mozilla.org redirected to /en-GB/. When we set only the header, it redirected to /de/. Mozilla picks the language on the server, from the header.
The Playwright recipe
Playwright's documentation says locale affects navigator.language, the Accept-Language header and number and date formatting, and timezoneId changes the context's time zone. Our probe confirmed all of it. One difference from Puppeteer: Playwright sent the bare tag, Accept-Language: de-DE, with no de fallback. A server that only knows de should still match it, but test that if your site has unusual language codes.
This is the script that captured the five versions of mozilla.org at the top of this article. A new context per locale keeps cookies from one language out of the next capture:
import { chromium } from "playwright";
const locales = [
{ locale: "en-US", timezoneId: "America/New_York" },
{ locale: "de-DE", timezoneId: "Europe/Berlin" },
{ locale: "fr-FR", timezoneId: "Europe/Paris" },
{ locale: "es-ES", timezoneId: "Europe/Madrid" },
{ locale: "ja-JP", timezoneId: "Asia/Tokyo" },
];
const browser = await chromium.launch();
for (const { locale, timezoneId } of locales) {
const context = await browser.newContext({ locale, timezoneId, viewport: { width: 1280, height: 800 } });
const page = await context.newPage();
await page.goto("https://www.mozilla.org/", { waitUntil: "load" });
await page.waitForTimeout(1500);
await page.screenshot({ path: `mozilla-${locale}.png` });
console.log(locale, page.url());
await context.close();
}
await browser.close();
Output:
en-US https:
de-DE https:
fr-FR https:
es-ES https:
ja-JP https:
One site in five languages: what changed
The captures show what localization testing with screenshots is for. The layout held up in every language, but the text did not take the same space:
| Locale | Final URL | Hero heading lines | Visible characters | Page height |
|---|
| en-US | /en-US/ | 1 | 4,789 | 7,411 px |
| de-DE | /de/ | 2 | 5,507 (+15%) | 7,804 px (+5%) |
| fr-FR | /fr/ | 2 | 6,106 (+28%) | 7,918 px (+7%) |
| es-ES | /es-ES/ | 3 | 5,530 (+15%) | 7,825 px (+6%) |
| ja-JP | /ja/ | 1 | 3,884 (−19%) | 7,512 px (+1%) |
Characters are the page's visible text without spaces, measured with document.body.innerText. The language versions are not word-for-word translations, so treat the counts as a rough guide to how much text each version carries. The heading lines are counted from the captures. The Spanish heading, Te damos la bienvenida a Mozilla, wraps to three lines, which pushes the text and link below it further down than in any other version.
A screenshot per locale catches exactly this kind of change: a button that moves, a heading that wraps, a label that no longer fits. In a visual regression test, keep one baseline per locale rather than comparing languages against each other. Pin the time zone, too, or a page that prints the time will differ on every run.
When the locale isn't enough
Not every site picks its language from the browser. We ran the same five contexts against airbnb.com:
- With
en-US, it redirected to airbnb.co.uk and served lang="en-GB". The header asked for American English, but the site chose another country version.
- With
es-ES, it went to es.airbnb.com and served lang="es-419", Latin American Spanish, not Spanish for Spain.
- German, French and Japanese went to de., fr. and ja.airbnb.com as expected.
Sites like this also look at the visitor's location, cookies or a country domain. For them, a locale setting gets you the language but not necessarily the country. To test a country version, open its URL directly, or set the location as well. Playwright supports geolocation with the matching permission, and our screenshot API documents geolocation, timezone and autoLocale options in its geolocation and locale guide.
A checklist for localized screenshots
- Set the header,
navigator.language and the Intl locale together: Playwright's locale, or the three Puppeteer calls above.
- Set a time zone that matches the locale, so dates, times and "today" match what a reader there sees.
- Use a new browser context per locale, so a language cookie from one capture doesn't decide the next.
- Log the final URL and
document.documentElement.lang, and check them before you trust the image.
- Don't rely on
--lang or LANG in headless mode. In our tests they worked only with extra locale packages on Linux, or in the old headless shell.
- Keep one baseline per locale, and look hardest at headings, buttons and navigation, where longer translations wrap first.