Pete Posted September 10, 2018 Share Posted September 10, 2018 Hi folks SCAYT (Spell Check As You Type) is a great CKEditor plugin, but does anyone know if it's possible to get it working with multi-language fields? As in configure it to check for English in the English version of a CKE field and German in another for example? 2 Link to comment Share on other sites More sharing options...
Moritz Posted December 15, 2020 Share Posted December 15, 2020 So, as I just found this via Google, I'll dig out this thread to help others: You have to edit site/modules/InputfieldCKEditor/config.js and add the following section inside the CKEDITOR.editorConfig function: const languages = { 1010: "de_DE", 1012: "en_US", }; const t = setInterval(() => { const ed = Object.values(CKEDITOR.instances).filter(x => x.config === config)[0]; const lang = ed.element.$.parentElement.getAttribute("data-language"); if (!lang || !languages[lang]) return clearInterval(t); if (!ed.scayt) return; // wait until scayt is initialized clearInterval(t); ed.scayt.setLang(languages[lang]); }, 100); You can find out the language IDs by looking at the URL of your language configuration page - it ends with e.g. ?id=1012 Link to comment Share on other sites More sharing options...
Moritz Posted December 15, 2020 Share Posted December 15, 2020 Oh, just noted that to make this work with frontend editing, you'll have to add replace the "const lang" line with the following line: const lang = ed.element.$.parentElement.getAttribute("data-language") || ed.element.$.parentElement.getAttribute("data-lang"); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now