[SSE] Fix applying spellcheck language

This commit is contained in:
Julia Radzhabova 2020-08-21 21:18:03 +03:00
parent be49f22ab1
commit b01756ce55

View file

@ -1381,21 +1381,26 @@ define([
value; value;
if (sessionValue) if (sessionValue)
value = parseInt(sessionValue); value = parseInt(sessionValue);
else else {
value = this.mode.lang ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.mode.lang)) : 0x0409; var code = this.mode.lang ? Common.util.LanguageInfo.getLocalLanguageCode(this.mode.lang) : 0x0409;
value = code ? parseInt(code) : 0x0409;
}
if (langs && langs.length > 0) { if (langs && langs.length > 0) {
if (this.cmbDictionaryLanguage.store.length === 0 || change) { if (this.cmbDictionaryLanguage.store.length === 0 || change) {
this.cmbDictionaryLanguage.setData(langs); this.cmbDictionaryLanguage.setData(langs);
} }
var item = this.cmbDictionaryLanguage.store.findWhere({value: value}); var item = this.cmbDictionaryLanguage.store.findWhere({value: value});
if (!item && allLangs[value]) { if (!item) {
value = allLangs[value][0].split(/[\-\_]/)[0]; if (allLangs[value]) {
item = this.cmbDictionaryLanguage.store.find(function(model){ var str = allLangs[value][0].split(/[\-\_]/)[0],
return model.get('shortName').indexOf(value)==0; code = Common.util.LanguageInfo.getLocalLanguageCode(str);
}); value = code!==null ? parseInt(code) : value;
}
this.cmbDictionaryLanguage.setValue(Common.util.LanguageInfo.getLocalLanguageName(value)[1]);
} else {
this.cmbDictionaryLanguage.setValue(item.get('value'));
value = this.cmbDictionaryLanguage.getValue();
} }
this.cmbDictionaryLanguage.setValue(item ? item.get('value') : langs[0].value);
value = this.cmbDictionaryLanguage.getValue();
if (value !== parseInt(sessionValue)) { if (value !== parseInt(sessionValue)) {
Common.Utils.InternalSettings.set("sse-spellcheck-locale", value); Common.Utils.InternalSettings.set("sse-spellcheck-locale", value);
} }