[SSE] Debug formulas (set different languages)

This commit is contained in:
Julia Radzhabova 2019-03-04 16:02:57 +03:00
parent 325667e072
commit cbb3fe5b74
4 changed files with 49 additions and 15 deletions

View file

@ -60,6 +60,9 @@ define([
initialize: function () {
var me = this;
me.langJson = {};
me.langDescJson = {};
this.addListeners({
'FileMenu': {
'settings:apply': function() {
@ -124,20 +127,50 @@ define([
var me = this;
lang = (lang || 'en').split(/[\-_]/)[0].toLowerCase();
if ( lang != 'en' ) {
Common.Utils.InternalSettings.set("sse-settings-func-locale", lang);
Common.Utils.InternalSettings.set("sse-settings-func-locale", lang);
if (me.langJson[lang]) {
me.api.asc_setLocalization(me.langJson[lang]);
Common.NotificationCenter.trigger('formula:settings', this);
} else if (lang == 'en') {
me.api.asc_setLocalization(undefined);
Common.NotificationCenter.trigger('formula:settings', this);
} else {
Common.Utils.loadConfig('resources/formula-lang/' + lang + '.json',
function (config) {
if ( config != 'error' )
if ( config != 'error' ) {
me.langJson[lang] = config;
me.api.asc_setLocalization(config);
Common.NotificationCenter.trigger('formula:settings', this);
}
});
} else me.api.asc_setLocalization(undefined);
}
Common.Utils.loadConfig('resources/formula-lang/' + lang + '_desc.json',
function (config) {
if ( config != 'error' )
me.loadingFormulas(config);
});
if (me.langDescJson[lang])
me.loadingFormulas(me.langDescJson[lang]);
else {
Common.Utils.loadConfig('resources/formula-lang/' + lang + '_desc.json',
function (config) {
if ( config != 'error' ) {
me.langDescJson[lang] = config;
me.loadingFormulas(config);
} else {
Common.Utils.loadConfig('resources/formula-lang/en_desc.json',
function (config) {
me.langDescJson[lang] = (config != 'error') ? config : null;
me.loadingFormulas(me.langDescJson[lang]);
});
}
});
}
},
getDescription: function(lang) {
if (!lang) return '';
lang = lang.toLowerCase() ;
if (this.langDescJson[lang])
return this.langDescJson[lang];
return null;
},
showDialog: function () {
@ -145,8 +178,10 @@ define([
if ( this.needUpdateFormula ) {
this.needUpdateFormula = false;
this.formulas.fillFormulasGroups();
this.formulas.fillFunctions('All');
if (this.formulas.$window) {
this.formulas.fillFormulasGroups();
this.formulas.fillFunctions('All');
}
}
this.formulas.show();
}

View file

@ -78,9 +78,6 @@ define([
'Statusbar': {
'sheet:changed': _.bind(this.onApiSheetChanged, this)
},
'LeftMenu': {
'settings:apply': _.bind(this.applyFormulaSettings, this)
},
'Common.Views.Header': {
'toolbar:setcompact': this.onChangeViewMode.bind(this),
'print': function (opts) {
@ -121,6 +118,7 @@ define([
}
});
Common.NotificationCenter.on('page:settings', _.bind(this.onApiSheetChanged, this));
Common.NotificationCenter.on('formula:settings', _.bind(this.applyFormulaSettings, this));
this.editMode = true;
this._isAddingShape = false;

View file

@ -56,7 +56,7 @@ define([
_options = {};
_.extend(_options, {
width : 310,
width : 350,
height : 490,
contentWidth : 390,
header : true,

View file

@ -42,6 +42,7 @@
font-weight: bold;
}
word-wrap: break-word;
}
}
}