diff --git a/NEWS b/NEWS index eb1816456..f22175b69 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,7 @@ Bug fixes - [web] fixed handling of contact organizations (#4028) - [web] fixed handling of attachments in mail editor (#4058, #4063) - [web] fixed saving draft outside Mail module (#4071) + - [web] fixed SCAYT automatic language selection in HTML editor 3.2.7 (2017-02-14) ------------------ diff --git a/UI/WebServerResources/js/vendor/ckeditor/ck.js b/UI/WebServerResources/js/vendor/ckeditor/ck.js index aafa8d02b..5a20c18d4 100644 --- a/UI/WebServerResources/js/vendor/ckeditor/ck.js +++ b/UI/WebServerResources/js/vendor/ckeditor/ck.js @@ -56,7 +56,16 @@ if (attr.ckLocale) { locale = $parse(attr.ckLocale)($scope); options.language = locale; - options.scayt_sLang = locale; + + // Pickup the first matching language supported by SCAYT + // See http://docs.ckeditor.com/#!/guide/dev_howtos_scayt + options.scayt_sLang = _.find(['en_US', 'en_GB', 'pt_BR', 'da_DK', 'nl_NL', 'en_CA', 'fi_FI', 'fr_FR', 'fr_CA', 'de_DE', 'el_GR', 'it_IT', 'nb_NO', 'pt_PT', 'es_ES', 'sv_SE'], function(sLang) { + return sLang.lastIndexOf(locale, 0) == 0; + }) || 'en_US'; + + // Disable caching of the language + // See https://github.com/WebSpellChecker/ckeditor-plugin-scayt/issues/126 + options.scayt_disableOptionsStorage = 'lang'; } if (attr.ckMargin) {