[SSE] Separator settings

This commit is contained in:
Julia Svinareva 2019-11-29 11:29:13 +03:00
parent e114eb5b4a
commit 8e28b90c73
3 changed files with 47 additions and 12 deletions

View file

@ -386,8 +386,12 @@ define([
this.api.asc_setAutoSaveGap(value);
}
value = Common.localStorage.getItem("sse-settings-reg-settings");
if (value!==null) this.api.asc_setLocale(parseInt(value));
var reg = Common.localStorage.getItem("sse-settings-reg-settings"),
decimal = Common.localStorage.getItem("sse-settings-decimal-separator"),
group = Common.localStorage.getItem("sse-settings-group-separator");
decimal = decimal === 'undefined' ? undefined : decimal;
group = group === 'undefined' ? undefined : group;
if (reg!==null) this.api.asc_setLocale(parseInt(reg), decimal, group);
menu.hide();

View file

@ -342,17 +342,21 @@ define([
this.headerView.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '')
.setUserName(this.appOptions.user.fullname);
var value = Common.localStorage.getItem("sse-settings-reg-settings");
if (value!==null)
this.api.asc_setLocale(parseInt(value));
var reg = Common.localStorage.getItem("sse-settings-reg-settings"),
decimal = Common.localStorage.getItem("sse-settings-decimal-separator"),
group = Common.localStorage.getItem("sse-settings-group-separator");
decimal = decimal === 'undefined' ? undefined : decimal;
group = group === 'undefined' ? undefined : group;
if (reg!==null)
this.api.asc_setLocale(parseInt(reg), decimal, group);
else {
value = this.appOptions.region;
value = Common.util.LanguageInfo.getLanguages().hasOwnProperty(value) ? value : Common.util.LanguageInfo.getLocalLanguageCode(value);
if (value!==null)
value = parseInt(value);
reg = this.appOptions.region;
reg = Common.util.LanguageInfo.getLanguages().hasOwnProperty(reg) ? reg : Common.util.LanguageInfo.getLocalLanguageCode(reg);
if (reg!==null)
reg = parseInt(reg);
else
value = (this.editorConfig.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.editorConfig.lang)) : 0x0409;
this.api.asc_setLocale(value);
reg = (this.editorConfig.lang) ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.editorConfig.lang)) : 0x0409;
this.api.asc_setLocale(reg, decimal, group);
}
value = Common.localStorage.getBool("sse-settings-r1c1");

View file

@ -769,7 +769,11 @@ define([
this.chSeparator = new Common.UI.CheckBox({
el: $markup.findById('#fms-chb-separator-settings'),
labelText: this.strUseSeparatorsBasedOnRegionalSettings
});
}).on('change', _.bind(function(field, newValue, oldValue, eOpts){
var checked = field.getValue() === 'checked';
this.inputDecimalSeparator.setDisabled(checked);
this.inputThousandsSeparator.setDisabled(checked);
}, this));
var keyDown = function(event){
var key = event.key,
@ -887,6 +891,17 @@ define([
this.cmbRegSettings.setValue(Common.util.LanguageInfo.getLocalLanguageName(value)[1]);
}
this.updateRegionalExample(value);
var decimal = this.api.asc_getDecimalSeparator();
this.inputDecimalSeparator.setValue(decimal ? decimal : '');
var group = this.api.asc_getGroupSeparator();
this.inputThousandsSeparator.setValue(group ? group : '');
var isBaseSettings = _.isUndefined(decimal) && _.isUndefined(group);
this.chSeparator.setValue(isBaseSettings);
this.inputDecimalSeparator.setDisabled(isBaseSettings);
this.inputThousandsSeparator.setDisabled(isBaseSettings);
},
applySettings: function() {
@ -908,6 +923,18 @@ define([
if (this.cmbRegSettings.getSelectedRecord())
Common.localStorage.setItem("sse-settings-reg-settings", this.cmbRegSettings.getValue());
var decimal,
group;
if (this.chSeparator.isChecked()) {
decimal = undefined;
group = undefined;
} else {
decimal = this.inputDecimalSeparator.getValue();
group = this.inputThousandsSeparator.getValue();
}
Common.localStorage.setItem("sse-settings-decimal-separator", decimal);
Common.localStorage.setItem("sse-settings-group-separator", group);
Common.localStorage.save();
if (this.menu) {
this.menu.fireEvent('settings:apply', [this.menu]);