humanswitch / consentcookie

Open source AVG solution for websites
Apache License 2.0
27 stars 10 forks source link

Set default language through CC API #57

Closed christianvriens closed 6 years ago

christianvriens commented 6 years ago

Description

This options is very handy for multi language websites. The consent cookie can then automaticly be set by the website to the default language.

Expected Behavior

Is described in #55.

StevenChoo commented 6 years ago

@christianvriens This is already implemented but not yet documented.

You can use the following to set the language. It works reactively

// Premise is ConsentCookie is initialized and available as global object.
// Change language to 'en'
ConsentCookie.setLanguage('en');
// Language is inmediatly changed to 'en' and the resources configured in the config with key 'en' are used.
christianvriens commented 6 years ago

Documentation is added on CC website: https://www.consentcookie.nl/doc/consentcookie/technische-documentatie/#5811