[SSE] For Bug 35040. Show current document locale in the settings in left panel.

This commit is contained in:
Julia Radzhabova 2017-06-01 16:48:33 +03:00
parent 2af3bd56cd
commit f69672d245
2 changed files with 10 additions and 27 deletions

View file

@ -993,8 +993,8 @@ define([
onCustomNumberFormat: function() { onCustomNumberFormat: function() {
var me = this, var me = this,
value = Common.localStorage.getItem("sse-settings-reg-settings"); value = me.api.asc_getLocale();
value = (value!==null) ? parseInt(value) : ((me.toolbar.mode.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(me.toolbar.mode.lang)) : 0x0409); (!value) && (value = ((me.toolbar.mode.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(me.toolbar.mode.lang)) : 0x0409));
(new SSE.Views.FormatSettingsDialog({ (new SSE.Views.FormatSettingsDialog({
api: me.api, api: me.api,
@ -1012,10 +1012,9 @@ define([
onNumberFormatOpenBefore: function(combo) { onNumberFormatOpenBefore: function(combo) {
if (this.api) { if (this.api) {
var me = this; var me = this,
value = me.api.asc_getLocale();
var value = Common.localStorage.getItem("sse-settings-reg-settings"); (!value) && (value = ((me.toolbar.mode.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(me.toolbar.mode.lang)) : 0x0409));
value = (value!==null) ? parseInt(value) : ((this.toolbar.mode.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.toolbar.mode.lang)) : 0x0409);
if (this._state.langId !== value) { if (this._state.langId !== value) {
this._state.langId = value; this._state.langId = value;

View file

@ -723,28 +723,12 @@ define([
this.cmbFuncLocale.setValue(item ? item.get('value') : 'en'); this.cmbFuncLocale.setValue(item ? item.get('value') : 'en');
this.updateFuncExample(item ? item.get('exampleValue') : this.txtExampleEn); this.updateFuncExample(item ? item.get('exampleValue') : this.txtExampleEn);
value = Common.localStorage.getItem("sse-settings-reg-settings"); value = this.api.asc_getLocale();
if (value!==null) { if (value) {
item = this.cmbRegSettings.store.findWhere({value: parseInt(value)}); item = this.cmbRegSettings.store.findWhere({value: value});
this.cmbRegSettings.setValue(item ? item.get('value') : 0x0409); this.cmbRegSettings.setValue(item ? item.get('value') : Common.util.LanguageInfo.getLocalLanguageName(value)[1]);
} else { } else {
if (this.mode.lang) { this.cmbRegSettings.setValue((this.mode.lang) ? Common.util.LanguageInfo.getLocalLanguageName(parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.mode.lang)))[1] : 0x0409);
var lang = this.mode.lang.toLowerCase(),
langshort = lang.split("-")[0].toLowerCase(),
code = Common.util.LanguageInfo.getLocalLanguageCode(lang),
codefull, codeshort;
this.cmbRegSettings.store.each(function(model){
var val = model.get('value'),
langname = model.get('langName').toLowerCase();
if ( langname == lang )
codefull = val;
if ( langname.indexOf(langshort)==0 )
codeshort = val;
});
code = (codefull) ? codefull : ((codeshort) ? codeshort : ((code) ? Common.util.LanguageInfo.getLocalLanguageName(code)[1] : 0x0409));
this.cmbRegSettings.setValue(code);
} else
this.cmbRegSettings.setValue(0x0409);
} }
this.updateRegionalExample(this.cmbRegSettings.getValue()); this.updateRegionalExample(this.cmbRegSettings.getValue());
}, },