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; 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(item ? item.get('value') : this.langs[0].value); combo.setValue(Common.util.LanguageInfo.getLocalLanguageName(value)[1]);
} else {
combo.setValue(item.get('value'));
value = combo.getValue(); 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);

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(item ? item.get('value') : langs[0].value); this.cmbDictionaryLanguage.setValue(Common.util.LanguageInfo.getLocalLanguageName(value)[1]);
} else {
this.cmbDictionaryLanguage.setValue(item.get('value'));
value = this.cmbDictionaryLanguage.getValue(); 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);
} }