[SSE] Fix Bug 50956

This commit is contained in:
Julia Radzhabova 2021-07-17 17:42:57 +03:00
parent 54a3676902
commit 230b553b26
5 changed files with 21 additions and 44 deletions

View file

@ -121,10 +121,7 @@ define([
if (this.formulasGroups && this.api) {
Common.Utils.InternalSettings.set("sse-settings-func-last", Common.localStorage.getItem("sse-settings-func-last"));
var deflang = (this.appOptions.lang || 'en').toLowerCase();
if (deflang=='pt-br' || deflang=='pt_br')
deflang = 'br';
this.reloadTranslations(Common.localStorage.getItem("sse-settings-func-locale") || deflang, true);
this.reloadTranslations(Common.localStorage.getItem("sse-settings-func-locale") || this.appOptions.lang, true);
var me = this;
@ -154,6 +151,8 @@ define([
onLaunch: function () {
this.formulasGroups = this.getApplication().getCollection('FormulaGroups');
SSE.Collections.formulasLangs = ['en', 'be', 'bg', 'ca', 'zh', 'cs', 'da', 'nl', 'fi', 'fr', 'de', 'el', 'hu', 'id', 'it', 'ja',
'ko', 'lv', 'lo', 'nb', 'pl', 'pt-br', 'pt', 'ro', 'ru', 'sk', 'sl', 'sv', 'es', 'tr', 'uk', 'vi'];
var descriptions = ['Financial', 'Logical', 'TextAndData', 'DateAndTime', 'LookupAndReference', 'Mathematic', 'Cube', 'Database', 'Engineering', 'Information',
'Statistical', 'Last10'];
@ -167,9 +166,15 @@ define([
},
reloadTranslations: function (lang, suppressEvent) {
var me = this;
lang = (lang || 'en').split(/[\-_]/)[0].toLowerCase();
lang = (lang || 'en').toLowerCase();
var index = _.indexOf(SSE.Collections.formulasLangs, lang);
if (index<0) {
lang = lang.split(/[\-_]/)[0];
index = _.indexOf(SSE.Collections.formulasLangs, lang);
}
lang = (index>=0) ? SSE.Collections.formulasLangs[index] : 'en';
var me = this;
Common.Utils.InternalSettings.set("sse-settings-func-locale", lang);
if (me.langJson[lang]) {
me.api.asc_setLocalization(me.langJson[lang]);

View file

@ -875,40 +875,12 @@ define([
]
});
var formula_arr = [
{ value: 'en', displayValue: this.txtEn, exampleValue: this.txtExampleEn },
{ value: 'be', displayValue: this.txtBe, exampleValue: this.txtExampleBe },
{ value: 'bg', displayValue: this.txtBg, exampleValue: this.txtExampleEn },
{ value: 'ca', displayValue: this.txtCa, exampleValue: this.txtExampleCa },
{ value: 'zh', displayValue: this.txtZh, exampleValue: this.txtExampleEn },
{ value: 'cs', displayValue: this.txtCs, exampleValue: this.txtExampleCs },
{ value: 'da', displayValue: this.txtDa, exampleValue: this.txtExampleDa },
{ value: 'nl', displayValue: this.txtNl, exampleValue: this.txtExampleNl },
{ value: 'fi', displayValue: this.txtFi, exampleValue: this.txtExampleFi },
{ value: 'fr', displayValue: this.txtFr, exampleValue: this.txtExampleFr },
{ value: 'de', displayValue: this.txtDe, exampleValue: this.txtExampleDe },
{ value: 'el', displayValue: this.txtEl, exampleValue: this.txtExampleEn },
{ value: 'hu', displayValue: this.txtHu, exampleValue: this.txtExampleHu },
{ value: 'id', displayValue: this.txtId, exampleValue: this.txtExampleEn },
{ value: 'it', displayValue: this.txtIt, exampleValue: this.txtExampleIt },
{ value: 'ja', displayValue: this.txtJa, exampleValue: this.txtExampleEn },
{ value: 'ko', displayValue: this.txtKo, exampleValue: this.txtExampleEn },
{ value: 'lv', displayValue: this.txtLv, exampleValue: this.txtExampleEn },
{ value: 'lo', displayValue: this.txtLo, exampleValue: this.txtExampleEn },
{ value: 'nb', displayValue: this.txtNb, exampleValue: this.txtExampleNb },
{ value: 'pl', displayValue: this.txtPl, exampleValue: this.txtExamplePl },
{ value: 'br', displayValue: this.txtBrlang, exampleValue: this.txtExampleBr },
{ value: 'pt', displayValue: this.txtPtlang, exampleValue: this.txtExamplePt },
{ value: 'ro', displayValue: this.txtRo, exampleValue: this.txtExampleEn },
{ value: 'ru', displayValue: this.txtRu, exampleValue: this.txtExampleRu },
{ value: 'sk', displayValue: this.txtSk, exampleValue: this.txtExampleEn },
{ value: 'sl', displayValue: this.txtSl, exampleValue: this.txtExampleEn },
{ value: 'sv', displayValue: this.txtSv, exampleValue: this.txtExampleSv },
{ value: 'es', displayValue: this.txtEs, exampleValue: this.txtExampleEs },
{ value: 'tr', displayValue: this.txtTr, exampleValue: this.txtExampleTr },
{ value: 'uk', displayValue: this.txtUk, exampleValue: this.txtExampleEn },
{ value: 'vi', displayValue: this.txtVi, exampleValue: this.txtExampleEn }
];
var formula_arr = [];
SSE.Collections.formulasLangs.forEach(function(item){
var str = item.replace(/[\-_]/, '');
str = str.charAt(0).toUpperCase() + str.substring(1, str.length);
formula_arr.push({value: item, displayValue: me['txt' + str + 'lang'] || me['txt' + str], exampleValue: me['txtExample' + str] || me.txtExampleEn});
});
formula_arr.sort(function(a, b){
if (a.displayValue < b.displayValue) return -1;
if (a.displayValue > b.displayValue) return 1;
@ -1042,7 +1014,7 @@ define([
el : $markup.findById('#fms-cmb-theme'),
style : 'width: 160px;',
editable : false,
cls : 'input-group-nr',
cls : 'input-group-nr'
});
$markup.find('.btn.primary').each(function(index, el){
@ -1389,7 +1361,7 @@ define([
txtLo: 'Lao',
txtNb: 'Norwegian',
txtPtlang: 'Portuguese (Portugal)',
txtBrlang: 'Portuguese (Brazil)',
txtPtbr: 'Portuguese (Brazil)',
txtRo: 'Romanian',
txtSk: 'Slovak',
txtSl: 'Slovenian',
@ -1406,7 +1378,7 @@ define([
txtExampleHu: 'SZUM; MIN; MAX; DARAB',
txtExampleNb: 'SUMMER; MIN; STØRST; ANTALL',
txtExamplePt: 'SOMA; MÍNIMO; MÁXIMO; CONTAR',
txtExampleBr: 'SOMA; MÍNIMO; MÁXIMO; CONT.NÚM',
txtExamplePtbr: 'SOMA; MÍNIMO; MÁXIMO; CONT.NÚM',
txtExampleSv: 'SUMMA; MIN; MAX; ANTAL',
txtExampleTr: 'TOPLA; MİN; MAK; BAĞ_DEĞ_SAY'

View file

@ -2062,7 +2062,7 @@
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtNl": "Dutch",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtPl": "Polish",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtPt": "Point",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtBrlang": "Portuguese (Brazil)",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtPtbr": "Portuguese (Brazil)",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtPtlang": "Portuguese (Portugal)",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtRo": "Romanian",
"SSE.Views.FileMenuPanels.MainSettingsGeneral.txtRu": "Russian",