Skip to documentation content

Languages

How the banner picks a visitor's language, how translations are loaded, and how to override both.

CookieBeam ships seeded banner translations in 30 languages, and the banner picks one per visitor automatically. You can change the detection strategy, pin a default language, or supply your own translations.

Language and translation settings live in the banner designer: Dashboard → Banners → your banner → Design, in the Content section, where you can add languages, set the default, and edit per-language copy. Save in the designer, then Publish from the banner header — translation changes only reach visitors on publish. Verify by loading your site with a browser language (or geo location) that matches a configured language and checking the banner renders in it.

How the visitor's language is chosen

The banner's language configuration has an autoDetect mode. Each mode is a waterfall that stops at the first language you actually have content for:

  • geo — the visitor's country (resolved at the CDN edge) is mapped to a default language. If you don't bundle that language, the runtime fetches it on demand. If the country has no mapping or isn't configured, the visitor's browser language is tried next, then your configured default.
  • browser — the visitor's browser language preference list is tried in order, then the geo language, then the default. Only languages you can actually serve (bundled inline or declared for on-demand fetch) are considered.
  • document — the page's own lang attribute first, then the browser preference list, then geo, then the default.
  • none — always your configured default language.

Language matching is case-insensitive and falls back from a regional variant to its base language: a visitor preferring pt-BR can be served your pt translation.

The default language itself is your configured default if you have a translation for it; otherwise the first translation in your configuration.

Inline translations vs on-demand loading

When you publish a banner, CookieBeam inlines the default language plus every language you customized, and declares the remaining platform languages as dynamic languages. If detection picks a dynamic language, the runtime fetches it from the CookieBeam CDN at publish time's translation URL — so banners stay small without giving up coverage.

A failed fetch never strands the visitor: resolution falls back to your default language, then to English, and finally to a minimal built-in English copy, so the banner always renders.

Overriding translations

Three resolver strategies are available in the language configuration:

  • Inline (the default) — translations live in the banner configuration. If the resolved language isn't bundled, the runtime tries the platform CDN copy before giving up.
  • URL template — provide a URL containing a {lang} placeholder (for example https://example.com/i18n/{lang}.json); the runtime fetches and validates the JSON per language.
  • Function — self-hosted installs can supply a loader function that returns the translation object.

Fetched or supplied translations are validated against the expected shape (consent modal and preferences modal fields) before use, and cached for the page lifetime so repeat resolutions don't refetch.

Per-region wording

Regional rules can override banner text per language on top of everything above — use this for legally reviewed wording per jurisdiction rather than for general translation work. See Regional rules.