Language detection for cookie banner

How to select language detection method?

Nelson
Written by NelsonLast update 3 months ago

You can select your cookie banner language detection. Go to your CookieScript user account > Settings > Translations, where you will find the LANGUAGE DETECTION tab.

Select the desired option for your cookie banner.

Use translations only if you have more than one language on your website. If your website has only one language, disable language detection, and update necessary texts for the default language.

If your website has more than one language, add translations for any additional languages besides the default language, and choose the method how to detect language. If you choose Auto detect language, the cookie banner will try to detect language with HTML tag. If that fails, it will try to detect language with the current web page URL.

Detecting language using HTML tag only is the most common option. Usually, a website has a selected language written in HTML tag, which makes it useful for any automated software to detect website language. HTML tag is a top parent element for all other elements on the page.

Example:

<html lang="it">

If you select to detect language using Website URL only, the current page link will be analyzed for any existing languages. The translation will be applied if the language code is found in the link.

Example:

https://example.com/it/somepage.html

would trigger Italian translation since the page URL contains /it/

Read more about the Cookie consent on a multi-language website.

You can also add a new language to your cookie banner by clicking Add New Translation button, and choosing a new language from the language drop-down list.

Note: If language detection doesn't work (default language is shown for all subdomains), make sure your website provides language data by one of the options:

  • URL indicates about the language used;

  • Website has the HTML tag in the code.


Did this answer your question?