Can I use getConfig? / How #221
-
Hi again, Since my project portfolio is large and includes several multilingual projects, I need to reduce the data that is downloaded. Is there any possible way to do it? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
can you be more specific? Do you need to lazyload languages (load a specific language only if needed) or do you simply want to have 2 different files (loaded entirely)? If it's the second, then yes, it can be easily done. |
Beta Was this translation helpful? Give feedback.
-
Hi, In the first file there will be a complete initialization, including settings. (force, model position etc...)
At the moment I have it set so that there is only an initialization in the first file. And in the second file I have settings (force, model position etc...), including language. |
Beta Was this translation helpful? Give feedback.
-
this is fairly easy to achieve! You need to have a window.cc_languages = {
'en': {
consent_modal: {
title: ' We use cookies!',
description: '...',
// ...
},
settings_modal: {
// ...
}
},
'de': {
// ...
}
} You will then need to load // obtain plugin
var cc = initCookieConsent();
// load languages
cc.loadScript('cc_languages.js', function(){
// run plugin
cc.run({
current_lang: 'en',
// ...
languages: window.cc_languages
});
}); |
Beta Was this translation helpful? Give feedback.
-
@orestbida |
Beta Was this translation helpful? Give feedback.
@JiriBandura,
this is fairly easy to achieve!
You need to have a
.js
file — for the sake of this example I'll name itcc_languages.js
— with the following structure:You will then need to load
cc_languages.js
file before running the plugin: