Test a localized API with Accept-Language
An API that returns text people read (error messages, notification bodies, product names, formatted prices) usually picks the language from the Accept-Language header or a locale parameter. Each language is a separate path through the code, and the untranslated or half-translated one is the one nobody tested.
One header, many languages
Add the header to the folder's requests. If every request in the folder needs it, a folder pre-request script can set it instead, pm.request.headers.set('Accept-Language', pm.variables.get('lang')), so new requests get it too:
GET {{baseUrl}}/products/{{productId}}
Accept-Language: {{lang}}A data file with the languages you support and what you expect back:
lang,expectedContentLanguage,expectedTitle
en,en,Standing desk
pl,pl,Biurko stojące
uk,uk,Стіл для роботи стоячи
de-AT,de,Stehschreibtisch
pt-BR,pt-BR,Mesa com regulagem de altura
fr-CA,en,Standing deskThe last two rows test regional variants: de-AT falls back to de, and fr-CA falls back to the default because French isn't supported. Write the expected fallbacks from your product's rules, not from what the API happens to do.
const lang = pm.iterationData.get('lang');
pm.test(`${lang}: Content-Language`, () => {
pm.expect(pm.response.headers.get('Content-Language')).to.equal(pm.iterationData.get('expectedContentLanguage'));
});
pm.test(`${lang}: translated title`, () => {
pm.expect(pm.response.json().title).to.equal(pm.iterationData.get('expectedTitle'));
});requestarium run-collection "Catalog API" --folder "Localized" --data languages.csv --env StagingError messages
Error messages are the text most often left untranslated, because they're spread through validation code. Send a request that fails validation in each language:
const lang = pm.iterationData.get('lang');
const body = pm.response.json();
pm.test(`${lang}: error code is not translated`, () => {
pm.expect(body.code).to.equal('validation_failed');
});
if (lang !== 'en' && pm.iterationData.get('expectedContentLanguage') !== 'en') {
pm.test(`${lang}: error message is not the English one`, () => {
pm.expect(body.message).to.not.equal('Quantity must be between 1 and 999.');
});
}The first check matters as much as the second: clients should branch on code, and a translated code breaks them.
Things that should never change by language
Localization belongs in display fields. Machine-readable values must stay the same:
- enum values (
"status": "shipped", not"wysłane"); - dates in ISO 8601 (
2026-11-24T10:00:00Z), with a separate formatted field if you need one; - numbers as numbers (
42.5), not"42,5"; - currency codes (
EUR).
A JSON Schema assertion with enum and format on those fields, inherited from the folder, checks every language at once.
Formatted values
If the API also returns display strings, check the local format:
lang,expectedPriceDisplay
en,"€1,299.00"
pl,"1299,00 €"
de,"1.299,00 €"Formatting libraries sometimes use a non-breaking space (U+00A0 or U+202F) between the number and the symbol. If your check fails on a string that looks identical, compare JSON.stringify of both in the console to see the hidden character.
Fallback and bad input
Accept-Language: *and no header at all: the default language.- A weighted list,
Accept-Language: pl;q=0.9, en;q=0.8: Polish. - Garbage,
Accept-Language: !!!: the default, never a500.
Caching
If the same URL returns different languages, the response must say Vary: Accept-Language, or a CDN will serve the first language it cached to everyone. See testing caching headers.