[SSE] Fix applying spellcheck language

This commit is contained in:
Julia Radzhabova 2020-08-21 20:40:07 +03:00
parent 8decfb1b43
commit be49f22ab1

View file

@ -174,8 +174,10 @@ define([
isApply = false; isApply = false;
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;
}
var combo = this.panelSpellcheck.cmbDictionaryLanguage; var combo = this.panelSpellcheck.cmbDictionaryLanguage;
if (this.langs && this.langs.length>0) { if (this.langs && this.langs.length>0) {
if (combo.store.length === 0) { if (combo.store.length === 0) {
@ -183,14 +185,17 @@ define([
isApply = true; isApply = true;
} }
var item = combo.store.findWhere({value: value}); var item = combo.store.findWhere({value: value});
if (!item && this.allLangs[value]) { if (!item) {
value = this.allLangs[value][0].split(/[\-\_]/)[0]; if (this.allLangs[value]) {
item = combo.store.find(function(model){ var str = this.allLangs[value][0].split(/[\-\_]/)[0],
return model.get('shortName').indexOf(value)==0; code = Common.util.LanguageInfo.getLocalLanguageCode(str);
}); value = code!==null ? parseInt(code) : value;
}
combo.setValue(Common.util.LanguageInfo.getLocalLanguageName(value)[1]);
} else {
combo.setValue(item.get('value'));
value = combo.getValue();
} }
combo.setValue(item ? item.get('value') : this.langs[0].value);
value = combo.getValue();
} else { } else {
combo.setValue(Common.util.LanguageInfo.getLocalLanguageName(value)[1]); combo.setValue(Common.util.LanguageInfo.getLocalLanguageName(value)[1]);
combo.setDisabled(true); combo.setDisabled(true);