Multilangual support when using CMS to control language

When you operate a multilingual website and would like to have the cookie banner displayed in the same language as your website (E.g. English for “mywebsite.com/en” and Spanish for “mywebsite.com/es”) you can use the data-culture attribute.

To set the language dynamically by your content management system (CMS), use the built in CMS function to get the language of the current page.
Example on implementing language match in WordPress CMS header template file (manual blocking mode):

<?php $curLang = substr(get_locale()), 0, 2); ?>

<script id="CookieConsent" data-culture="<?php echo $curLang?>" src="https://consent.cookiebot.com/uc.js" data-cbid="00000000-0000-0000-0000-000000000000" type="text/javascript" async></script>

Example on implementing language match in WordPress CMS header template file (automatic blocking mode):

<?php $curLang = substr(get_locale()), 0, 2); ?>

<script id="CookieConsent" data-culture="<?php echo $curLang?>" src="https://consent.cookiebot.com/uc.js" data-cbid="00000000-0000-0000-0000-000000000000" data-blockingmode="auto" type="text/javascript"></script>

In the Cookiebot manager you must create a language variant for each language used on your website. If no language variant has been created for the language applied in data-culture, the language of the banner and declaration will show in the default language selected in the Cookiebot manager.

Using the data-culture attribute overrides the configuration of default language and auto-detection of the individual user’s preferred language.

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Inhoud