Cookie consent on multi-language website

How to get cookie consent on multi-language website?

Written by NelsonLast update 4 months ago

With CookieScript, you can have a multilingual website. CookieScript detects your website's language, and your cookie banner will be presented in the right language.

How website language is detected? 

There are few ways you can set up Cookie-Script to detect currently selected website language: 

  1. Disabled: do not use translations

  2. Auto detect language: try to detect language with HTML tag and if that fails, try to detect language with current webpage URL.

  3. HTML tag only: This is the most common option. Usually, a website has currently 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.


    <html lang="it">
  4. Website URL only: Current page link is analyzed for any existing languages, Translation is applied if language code is found in the link. 


    would trigger Italian translation since page URL contains /it/

Setting language inside the script tag

You can also hardcode the language inside the script tag. This might be useful if none of the options above fits your needs. Or if you just want to set the language from a backend. Script tag language will override all other methods. 

The setting language inside the script tag can be done with a  data-cs-lang attribute: 

<script type="text/javascript" charset="UTF-8" data-cs-lang="it" src="//"></script>

How do I add new translations?

Adding new translations is pretty straightforward, just click  + Add translation button, choose translation language, and fill in all the translatable fields. You can add many translations to the same item. If some languages are not needed, you can delete them with the Delete translation button.

Note: If the user agreed to cookie usage in one language, his choice will be remembered in another language.

Note: In case a certain translation string is not available in translation, original (non translated) text will be used.

Custom languages

We have included all EU languages for selection and also added pre-defined translations for those languages. However, if you need to translate the CookieScript popup to some other language, just choose Another language in language selector and enter custom language code. 

Translating cookie descriptions. 

All pre-filled known cookie descriptions will be automatically translated to any EU language that is used in your banner. You can still adjust those translations if needed in the Cookies section.

Did this answer your question?