[SSE] Fix spell checking settings

This commit is contained in:
Julia Svinareva 2019-11-28 10:46:49 +03:00
parent 8c32885042
commit 997eb2f678
2 changed files with 12 additions and 10 deletions

View file

@ -126,7 +126,9 @@ define([
loadLanguages: function () {
var me = this;
if (this._initSettings) {
Common.Utils.InternalSettings.set("sse-spellcheck-locale", Common.localStorage.getItem("sse-spellcheck-locale"));
}
if (this.languages && this.languages.length>0) {
var langs = [], info;
@ -173,7 +175,7 @@ define([
return model.get('shortName').indexOf(value)==0;
});
}
combo.setValue(item ? item.get('value') : langs[0].value);
combo.setValue(item ? item.get('value') : this.langs[0].value);
value = combo.getValue();
} else {
combo.setValue(Common.util.LanguageInfo.getLocalLanguageName(value)[1]);
@ -181,7 +183,7 @@ define([
}
if (this.api) {
this.api.asc_setDefaultLanguage(value);
if (value !== sessionValue) {
if (value !== parseInt(sessionValue)) {
Common.Utils.InternalSettings.set("sse-spellcheck-locale", value);
}
}

View file

@ -1041,27 +1041,27 @@ define([
},
updateSettings: function() {
var lang = SSE.getController('Spellcheck').loadLanguages(),
allLangs = lang[0],
lang = lang[1];
var arrLang = SSE.getController('Spellcheck').loadLanguages(),
allLangs = arrLang[0],
langs = arrLang[1];
var sessionValue = Common.Utils.InternalSettings.get("sse-spellcheck-locale"),
value;
if (sessionValue)
value = parseInt(sessionValue);
else
value = this.mode.lang ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.mode.lang)) : 0x0409;
if (lang && lang.length > 0) {
this.cmbDictionaryLanguage.setData(lang);
if (langs && langs.length > 0) {
this.cmbDictionaryLanguage.setData(langs);
var item = this.cmbDictionaryLanguage.store.findWhere({value: value});
if (!item && allLangs[value]) {
value = allLangs[value][0].split(/[\-\_]/)[0];
item = combo.store.find(function(model){
item = this.cmbDictionaryLanguage.store.find(function(model){
return model.get('shortName').indexOf(value)==0;
});
}
this.cmbDictionaryLanguage.setValue(item ? item.get('value') : langs[0].value);
value = this.cmbDictionaryLanguage.getValue();
if (value !== sessionValue) {
if (value !== parseInt(sessionValue)) {
Common.Utils.InternalSettings.set("sse-spellcheck-locale", value);
}
} else {