From f69672d245426b43c2f9919a63a84b393bf379ea Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 1 Jun 2017 16:48:33 +0300 Subject: [PATCH] [SSE] For Bug 35040. Show current document locale in the settings in left panel. --- .../main/app/controller/Toolbar.js | 11 ++++---- .../main/app/view/FileMenuPanels.js | 26 ++++--------------- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index 215909926..04df2b51e 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -993,8 +993,8 @@ define([ onCustomNumberFormat: function() { var me = this, - value = Common.localStorage.getItem("sse-settings-reg-settings"); - value = (value!==null) ? parseInt(value) : ((me.toolbar.mode.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(me.toolbar.mode.lang)) : 0x0409); + value = me.api.asc_getLocale(); + (!value) && (value = ((me.toolbar.mode.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(me.toolbar.mode.lang)) : 0x0409)); (new SSE.Views.FormatSettingsDialog({ api: me.api, @@ -1012,10 +1012,9 @@ define([ onNumberFormatOpenBefore: function(combo) { if (this.api) { - var me = this; - - var value = Common.localStorage.getItem("sse-settings-reg-settings"); - value = (value!==null) ? parseInt(value) : ((this.toolbar.mode.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.toolbar.mode.lang)) : 0x0409); + var me = this, + value = me.api.asc_getLocale(); + (!value) && (value = ((me.toolbar.mode.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(me.toolbar.mode.lang)) : 0x0409)); if (this._state.langId !== value) { this._state.langId = value; diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 1a2a7f0da..5b26f1bec 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -723,28 +723,12 @@ define([ this.cmbFuncLocale.setValue(item ? item.get('value') : 'en'); this.updateFuncExample(item ? item.get('exampleValue') : this.txtExampleEn); - value = Common.localStorage.getItem("sse-settings-reg-settings"); - if (value!==null) { - item = this.cmbRegSettings.store.findWhere({value: parseInt(value)}); - this.cmbRegSettings.setValue(item ? item.get('value') : 0x0409); + value = this.api.asc_getLocale(); + if (value) { + item = this.cmbRegSettings.store.findWhere({value: value}); + this.cmbRegSettings.setValue(item ? item.get('value') : Common.util.LanguageInfo.getLocalLanguageName(value)[1]); } else { - if (this.mode.lang) { - 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.cmbRegSettings.setValue((this.mode.lang) ? Common.util.LanguageInfo.getLocalLanguageName(parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.mode.lang)))[1] : 0x0409); } this.updateRegionalExample(this.cmbRegSettings.getValue()); },