|
|
|
@ -7,17 +7,46 @@ document.addEventListener('DOMContentLoaded', function () { |
|
|
|
window.config['editor.translate_html'] && |
|
|
|
window.config['editor.translate_html'] && |
|
|
|
'true' === window.config['editor.translate_html'] |
|
|
|
'true' === window.config['editor.translate_html'] |
|
|
|
) { |
|
|
|
) { |
|
|
|
const isoCode = window.user.locale; |
|
|
|
var isoCode = window.user.locale; |
|
|
|
const translateElement = document.querySelector('.mce-translatehtml'); |
|
|
|
const translateElement = document.querySelector('.mce-translatehtml'); |
|
|
|
if (translateElement) { |
|
|
|
if (translateElement) { |
|
|
|
document.querySelectorAll('.mce-translatehtml').forEach(function (el) { |
|
|
|
document.querySelectorAll('.mce-translatehtml').forEach(function (el) { |
|
|
|
el.style.display = 'none'; |
|
|
|
el.style.display = 'none'; |
|
|
|
}); |
|
|
|
}); |
|
|
|
const selectedLang = document.querySelectorAll('[lang="' + isoCode + '"]'); |
|
|
|
const selectedLang = document.querySelectorAll('[lang="' + isoCode + '"]'); |
|
|
|
selectedLang.forEach(function (userLang) { |
|
|
|
if (selectedLang.length > 0) { |
|
|
|
userLang.classList.remove('hidden') |
|
|
|
selectedLang.forEach(function (userLang) { |
|
|
|
userLang.style.display = 'block'; |
|
|
|
userLang.classList.remove('hidden') |
|
|
|
}); |
|
|
|
userLang.style.display = 'block'; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// it checks content from old version
|
|
|
|
|
|
|
|
const langs = document.querySelectorAll('span[lang]'); |
|
|
|
|
|
|
|
if (langs.length > 0) { |
|
|
|
|
|
|
|
// it hides all contents with lang
|
|
|
|
|
|
|
|
langs.forEach(function (el) { |
|
|
|
|
|
|
|
el.style.display = 'none'; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// To show only the content by user language.
|
|
|
|
|
|
|
|
if (isoCode == 'pl_PL') { |
|
|
|
|
|
|
|
isoCode = 'pl'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (isoCode == 'fr_FR') { |
|
|
|
|
|
|
|
isoCode = 'fr'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (isoCode == 'en_US') { |
|
|
|
|
|
|
|
isoCode = 'en'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const selectedLang = document.querySelectorAll('span[lang="' + isoCode + '"]'); |
|
|
|
|
|
|
|
if (selectedLang.length > 0) { |
|
|
|
|
|
|
|
selectedLang.forEach(function (userLang) { |
|
|
|
|
|
|
|
userLang.classList.remove('hidden') |
|
|
|
|
|
|
|
userLang.style.display = 'block'; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|