MCPcopy
hub / github.com/orestbida/cookieconsent / updateCurrentLanguage

Function updateCurrentLanguage

playground/src/modules/language.js:220–243  ·  view source on GitHub ↗
(languageCode, newState)

Source from the content-addressed store, hash-verified

218 * @param {string} languageCode
219 */
220export function updateCurrentLanguage(languageCode, newState) {
221 const state = newState || getState();
222 const currLanguage = enabledTranslation(languageCode, state)
223 ? languageCode
224 : '-';
225
226 currentActiveLanguageSpan.textContent = currLanguage;
227
228 if (currLanguage === '-') {
229 window.CookieConsent && window.CookieConsent.reset();
230 return;
231 }
232
233 if (newState === false)
234 return;
235
236 if (!getById('cc-main')) {
237 setTimeout(() => {
238 reRunPlugin(state, 1);
239 }, 100);
240 } else {
241 reRunPlugin(state, 1);
242 }
243}

Callers 2

translations.jsFile · 0.90
language.jsFile · 0.85

Calls 4

getStateFunction · 0.90
enabledTranslationFunction · 0.90
getByIdFunction · 0.90
reRunPluginFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…