Configure display language

CookieHub offers various ways to manage the languages used for the widget and other dialogs. You can automatically detect the client’s language, use a single language or manually specify which language should be shown, which can be useful if you run a website on multiple languages and want CookieHub to match the language on each section of the site.

Please note that multiple languages are only available with CookieHub premium subscriptions.

Detect client language

When enabled, CookieHub will automatically detect the language sent by the client browser and display all labels and text in that language if it exists and is enabled for the domain.

Enable or disable languages

If you don’t enable additional languages manually in the CookieHub portal, the language selected as the default will be the only available language even if you enable the “Detect client language” feature. This is done to make sure the CookieHub javascript file is not larger that it has to be since each language adds about 5 KB.

To enable or disable languages, open your domain in the CookieHub portal, click the Settings tab and select the languages you want to make available in the Additional languages select box:

Editing labels

You can easily customize all labels and text shown in the CookieHub widget and settings dialog. To change a label or text, open your domain in the CookieHub portal and click the Content tab.

Default language

You can configure one language that’s used by default. To set the default language, open your domain in the CookieHub portal, click the Settings tab and select the default language in the Languages section.

The default will always be used unless overridden in the implementation code or if you have enabled the “Detect client language” feature.

Manually setting language

If you don’t want to automatically detect the client language but want to show CookieHub in different languages across your web site, you can easily force the language by adding a property as shown below to the cpm variable in the integration code on your web site.

<script type="text/javascript">
var cpm = {
  language: 'en'
};
(function(h,u,b){
var d=h.getElementsByTagName("script")[0],e=h.createElement("script");
e.async=true;e.src='https://cookiehub.net/c2/9f2842b1.js';
e.onload=function(){u.cookiehub.load(b);}
d.parentNode.insertBefore(e,d);
})(document,window,cpm);
</script>

If you want to set the display language based on the web sites URL, you can set the cpm language dynamically based on the url:

var cpm = {
  language: (location.href.indexOf('/de/') > 0 ? 'de' : 'en')
};

You can also make CookieHub match the language set in the <html lang attribute (with English as the default fallback):

var cpm = {
  language: (document.documentElement.lang != null ? document.documentElement.lang.substr(0,2) : 'en')
};

Still need help? Contact Us Contact Us