Compare commits

...

2 commits

Author SHA1 Message Date
Julia Radzhabova b01756ce55 [SSE] Fix applying spellcheck language 2020-08-21 21:18:03 +03:00
Julia Radzhabova be49f22ab1 [SSE] Fix applying spellcheck language 2020-08-21 20:40:07 +03:00
2 changed files with 28 additions and 18 deletions

View file

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

View file

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