Check 25.12 · Translating SEO elements

Translate cookie banners

Show the cookie banner in the page's language, not the browser's, with Complianz, CookieYes, Cookiebot, tarteaucitron.js or Shopify, without hindering search engines.

Priority
Important
Difficulty
Easy
Estimated time
1 to 4 h
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

The cookie consent banner appears on every page, on the first visit, before anything else. On a multilingual site, it must be fully translated (text, buttons, categories, link to the cookie policy) and, above all, shown in the language of the page being viewed, not that of the browser. Most consent management platforms (CMPs) guess the visitor's language or the page's language according to different rules: this check consists of configuring them. Once it is done, a visitor to /de/ sees a German banner, whatever their browser, with a link to the German cookie policy.

Why it matters

Consent is only valid if it is informed. The GDPR (General Data Protection Regulation) requires the request for consent to be presented in an intelligible form, using clear and plain language; a banner in a language the visitor cannot read hardly meets that requirement. The exact obligations vary from country to country: have the texts of each version approved by a lawyer.

For search engines, three points:

  • Language of the page: Google determines the language of a page from its visible content. A large banner in another language, present in the HTML, adds foreign text to the page.
  • Snippets: when the banner text is in the HTML, it can be picked up in a search result snippet. The data-nosnippet attribute, supported on div, span and section elements, excludes that block from Google's snippets.
  • Access to content: Google advises against redirecting requests to another page to collect consent. The banner must overlay the page, whose content stays in the HTML.

Generative engine crawlers that read the raw HTML see the banner text if it is rendered server-side; text from CMPs injected by JavaScript does not appear in that HTML. In both cases, a banner in the language of the page avoids a mixed-language page; see avoid mixed-language pages with partial translations (opens in a new tab).

What it improves

  • Compliance Consent presented in the visitor's language, a condition for an informed choice.
  • Consent rate per market, and therefore the quality of each language's audience and conversion data. Measure it before and after rather than assuming a gain.
  • Page consistency No block of foreign text in the version.
  • Snippets Less risk of seeing the banner text in a result, with data-nosnippet.
  • Rankings No direct effect. Google counts banners that respond to a legal obligation among acceptable interstitials, as long as they do not block access to the content through a redirect.

How to check

  1. Open each language in a private window, from a browser whose interface language differs from the page (set the browser language to English and visit /de/). The banner must be in German. This is the test that reveals CMPs set to follow the browser language.
  2. Open the detailed preferences: categories, descriptions, list of services, “Reject all” and “Save” buttons must be translated.
  3. Follow the link to the cookie policy: it must lead to the page in the same language.
  4. Check the button that reopens the preferences (floating icon, footer link) and the cookie declaration page if your CMP generates one.
  5. Check the declared language in the console:
({ pageLang: document.documentElement.lang, navigateur: navigator.language })

If the page declares de and the banner appears in the language of navigator.language, the CMP follows the browser.

  1. Look at the raw HTML: curl -s https://example.com/de/ | grep -i -c "cookie" tells you whether the banner text is rendered server-side; if so, check that it is in the right language and wrapped in a data-nosnippet element.

The banner's effect on performance is tested separately: see test before and after cookie consent (opens in a new tab).

How to implement

Before you start

Prepare the texts for each language, then configure the tool so that it follows the language of the page. Fictitious example:

Element fr de en
Title Vos choix en matière de cookies Ihre Cookie-Einstellungen Your cookie choices
Button Tout accepter Alle akzeptieren Accept all
Button Tout refuser Alle ablehnen Reject all
Button Personnaliser Einstellungen anpassen Customise
Category Mesure d'audience Statistik Analytics
Link Politique de cookies (/fr/cookies/) Cookie-Richtlinie (/de/cookie-richtlinie/) Cookie policy (/en/cookie-policy/)

Rules:

  • Language of the page first: the tool must read the language from the URL or the <html lang> attribute, not from the browser. Fix lang first if needed: see set html lang on each page (opens in a new tab).
  • Equal weight for accepting and rejecting in every language: a translation must not lengthen or hide the reject button.
  • Texts approved country by country, with a cookie policy that is adapted, not simply translated.
  • Length: translated buttons often overflow on mobile; test each language on a small screen.

Warning: the machine translation offered by most CMPs is a starting point. At the very least, have the buttons and the description of purposes reviewed by a speaker of the language.

WordPress

Versions WordPress 6.8 to 7.1; Complianz 7, CookieYes 3, Cookiebot 4, with WPML 4.x, Polylang 3.x or TranslatePress 3.x.

Complianz: the banner texts are plugin strings. Save the banner once in its Complianz settings, so that its strings are registered, then translate them in WPML > String Translation (WPML), in Languages > Translations, complianz group (Polylang), or in the TranslatePress visual editor. If a string does not appear with WPML, rescan the plugin's strings. WPML reports a known issue: with a default language that has a regional code, the banner can appear in the wrong language; the documented fix is to translate the texts into every language, including the default one.

CookieYes: the plugin alone allows one language in addition to the default language; beyond that, you need to connect it to the CookieYes web app. The multilingual banner is limited to paid plans; CookieYes then chooses the language from the page's lang attribute.

Cookiebot: the plugin inserts the Cookiebot script; see the data-culture setting below, to apply per language.

Your theme's banner: wrap it in a data-nosnippet element and run its texts through the translation functions (__(), esc_html__()), so that they appear in your multilingual plugin's string translation.

Shopify

Versions Shopify's native consent banner and Translate & Adapt app, all plans, November 2026.

Since May 2024, Shopify's native cookie banner has been shown in the customer's language, with default texts translated into 32 languages. To edit these texts, Shopify points to a translation app such as Translate & Adapt. Some merchants report that they cannot always find the banner texts in Translate & Adapt: check the published store in each language and, if a customized text stays in the primary language, use the translation tab of your consent app or restore the default text. Third-party banner apps have their own translation tab: configure them to follow the store language.

Cookiebot: by default, the automatic detection option picks the visitor's language. To force the page's language, add the data-culture attribute to the script, with the ISO 639-1 language code, in the template of each language:

<script id="Cookiebot" src="https://consent.cookiebot.com/uc.js"
        data-cbid="00000000-0000-0000-0000-000000000000"
        data-culture="DE" type="text/javascript" async></script>

data-culture takes precedence over the default language and automatic detection. The same attribute applies to the cookie declaration script (cd.js). Replace data-cbid with your domain's ID.

CookieYes (web app, paid plans): add the languages in the Languages section, then enter for each one the text and the URL of the translated cookie policy. Detection follows the page's lang attribute. If that attribute is missing or unreliable, force the language before the CookieYes script:

<script>
  window.ckySettings = {
    documentLang: window.location.pathname.startsWith('/de/') ? 'de' : 'fr',
  };
</script>

tarteaucitron.js: the library picks the language in this order: the tarteaucitronForceLanguage variable if it is set, then the page's lang attribute, then the browser language, with English as the default. With a correct lang attribute, there is nothing to do; otherwise, declare the variable before the script:

<script>
  var tarteaucitronForceLanguage = 'de';
</script>
<script src="/tarteaucitron/tarteaucitron.min.js"></script>

The link to the cookie policy is set with the privacyUrl option of tarteaucitron.init(): give the URL in the language of the page.

For another CMP, look in its documentation for a language attribute or option (often data-language, language or lang) and set it to the language of the page.

Laravel

Versions Laravel 11 to 13.

Pass the application language to the CMP from the layout, and the cookie policy through a named route:

{{-- resources/views/layouts/app.blade.php --}}
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
    <script>
        var tarteaucitronForceLanguage = @js(substr(app()->getLocale(), 0, 2));
    </script>
    <script src="{{ asset('tarteaucitron/tarteaucitron.min.js') }}"></script>
    <script>
        tarteaucitron.init({
            privacyUrl: @js(route('cookies')),
            orientation: 'bottom',
        });
    </script>
</head>

With Cookiebot, replace these scripts with the Cookiebot one with data-culture="{{ strtoupper(substr(app()->getLocale(), 0, 2)) }}". For a custom banner, run all its texts through __() and wrap it in a <div data-nosnippet>.

Next.js

Versions Next.js 15 and 16 (App Router).

Load the CMP script in the language layout, with the language of the route:

// app/[locale]/layout.tsx
import Script from 'next/script';

export default async function LocaleLayout({ children, params }: { children: React.ReactNode; params: Promise<{ locale: string }> }) {
  const { locale } = await params;

  return (
    <html lang={locale}>
      <body>
        <Script
          id="Cookiebot"
          src="https://consent.cookiebot.com/uc.js"
          data-cbid="00000000-0000-0000-0000-000000000000"
          data-culture={locale.slice(0, 2).toUpperCase()}
          strategy="beforeInteractive"
        />
        {children}
      </body>
    </html>
  );
}

strategy="beforeInteractive" is only accepted in the root layout: that is the case here if app/[locale]/layout.tsx holds the <html> and <body> tags, as in the usual next-intl setup. When the language changes through client-side navigation, the already loaded script is not run again: make the language switcher a regular link that reloads the page, or check that the CMP offers a method to change language without a reload.

Common mistakes

  • CMP set to the browser language: an English speaker visiting /de/ sees an English banner on a German page.
  • Reject button untranslated or less visible than the accept button in one language.
  • Link to the French cookie policy from every version.
  • Forgotten detailed preferences: first screen translated, categories and descriptions left in the source language.
  • Consent wall through a redirect to a dedicated page, which Google advises against.
  • Banner text picked up in snippets for lack of data-nosnippet on a server-rendered banner.
  • Wrong lang attribute, which makes CMPs that rely on it choose the wrong language.

Frequently asked questions

Can you use the CMP's machine translation?

Only as a starting point. CMPs often provide translated default texts, but your customized ones are not always translated, and the description of purposes is your legal responsibility. Have the buttons, the categories and the main text reviewed by a speaker of the language, and have the whole banner approved by a lawyer for each target country.

Do you need a different banner for each country?

Not necessarily a different banner, but different texts and sometimes different rules. Consent obligations vary between countries and regions, and some CMPs can show one banner template per geographic area. On a multilingual site, the banner language follows the page language; the legal rule applied may, however, depend on the visitor's location.

Updated on

Topic checklist (PDF)

And now?

In the “Translating SEO elements” topic

  1. Translate titles and meta descriptions
  2. Translate H1/H2/H3 headings
  3. Translate the main content
  4. Translate slugs
  5. Translate ALT text and captions
  6. Translate anchors, menus and footer
  7. Translate breadcrumbs and FAQs
  8. Translate text properties in structured data
  9. Translate Open Graph and set og:locale
  10. Translate CTAs and forms
  11. Translate error messages and 404 pages
  12. Translate cookie banners
  13. Translate downloadable documents
  14. Translate subtitles and transcripts
  15. Translate dynamic content and CMS plugins
  16. Check text embedded in images
  17. Detect untranslated strings