Closed christianvriens closed 6 years ago
Implemented the default and fallback language options.
Example:
ConsentCookie.init({
'general': {
'language': {
'default': 'fr',
'fallback': 'en'
}
},
'resources': {
'nl': {
'about': {
'title': 'Dutch',
},
},
'en': {
'about': {
'title': 'English',
},
},
'fr': {
'about': {
'title': 'French',
},
},
'en-US': {
'about': {
'title': 'en-US',
},
}
}
});
The example above shows a config with 4 languages defined, nl
, en
, fr
and en-US
.
Following the flow of the description the language in ConsentCookie is changed.
To test the fallback config, change the browser language to something not configured, like German and remove the default option. To see the changes, check the title of the about screen.
Used example script on my GTM demo page. As expected, the title ' French' appeared in the About screen.
Used example script on my GTM demo page. Removed all my languages in Google Chrome and added only the (not supported) "Danish" language. As expected, the title ''English' appeared in the About screen.
Issue #47 describes the functionality for multilanguage. But this is based on browser language and the default language is Dutch.
Description
You should be able to configure default and fallback languages
Preference in CC language:
definition
Default language throug CC-API. Set the default language through the API. Default language then this language is always used if available in language file. Next preferred browser language If preferred browser language isn't available then the next second etc. should be checked before going to the fallback (improvement for #47) Fallback language If browser language isn't available then this language should be used. Now this is dutch and this should be configurable CC default code language English is improvement
Context
In CC init json you should be able to configure in object 'general':
This should be used in ConsentCookie language setting.