Merge pull request #2223 from ONLYOFFICE/feature/fix-bugs

Feature/fix bugs
This commit is contained in:
maxkadushkin
2023-02-08 18:01:57 +03:00
committed by GitHub
5 changed files with 99 additions and 22 deletions

View File

@ -714,7 +714,60 @@
"txtSemicolon": "Semicolon",
"txtSpace": "Space",
"txtTab": "Tab",
"warnDownloadAs": "If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?"
"warnDownloadAs": "If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?",
"txtEn": "English",
"txtDe": "Deutsch",
"txtRu": "Russian",
"txtPl": "Polish",
"txtEs": "Spanish",
"txtFr": "French",
"txtIt": "Italian",
"txtBe": "Belarusian",
"txtBg": "Bulgarian",
"txtCa": "Catalan",
"txtZh": "Chinese",
"txtCs": "Czech",
"txtDa": "Danish",
"txtNl": "Dutch",
"txtFi": "Finnish",
"txtEl": "Greek",
"txtHu": "Hungarian",
"txtId": "Indonesian",
"txtJa": "Japanese",
"txtKo": "Korean",
"txtLv": "Latvian",
"txtLo": "Lao",
"txtNb": "Norwegian",
"txtPtlang": "Portuguese (Portugal)",
"txtPtbr": "Portuguese (Brazil)",
"txtRo": "Romanian",
"txtSk": "Slovak",
"txtSl": "Slovenian",
"txtSv": "Swedish",
"txtTr": "Turkish",
"txtUk": "Ukrainian",
"txtVi": "Vietnamese",
"txtExampleEn": "SUM; MIN; MAX; COUNT",
"txtExampleDe": "SUMME; MIN; MAX; ANZAHL",
"txtExampleRu": "СУММ; МИН; МАКС; СЧЁТ",
"txtExamplePl": "SUMA; MIN; MAX; ILE.LICZB",
"txtExampleEs": "SUMA; MIN; MAX; CALCULAR",
"txtExampleFr": "SOMME; MIN; MAX; NB",
"txtExampleIt": "SOMMA; MIN; MAX; CONTA.NUMERI",
"strFuncLocale": "Formula Language",
"strFuncLocaleEx": "Example: SUM; MIN; MAX; COUNT",
"txtExampleBe": "СУММ; МИН; МАКС; СЧЁТ",
"txtExampleCa": "SUMA; MIN; MAX; COMPT",
"txtExampleCs": "SUMA; MIN; MAX; POČET",
"txtExampleDa": "SUM; MIN; MAKS; TÆL",
"txtExampleNl": "SOM; MIN; MAX; AANTAL",
"txtExampleFi": "SUMMA; MIN; MAKS; LASKE",
"txtExampleHu": "SZUM; MIN; MAX; DARAB",
"txtExampleNb": "SUMMER; MIN; STØRST; ANTALL",
"txtExamplePt": "SOMA; MÍNIMO; MÁXIMO; CONTAR",
"txtExamplePtbr": "SOMA; MÍNIMO; MÁXIMO; CONT.NÚM",
"txtExampleSv": "SUMMA; MIN; MAX; ANTAL",
"txtExampleTr": "TOPLA; MİN; MAK; BAĞ_DEĞ_SAY"
}
}
}

View File

@ -517,17 +517,19 @@ class MainController extends Component {
}
});
this.api.asc_registerCallback('asc_onNeedUpdateExternalReferenceOnOpen', this.onNeedUpdateExternalReference);
this.api.asc_registerCallback('asc_onNeedUpdateExternalReferenceOnOpen', this.onNeedUpdateExternalReference.bind(this));
const storeAppOptions = this.props.storeAppOptions;
this.api.asc_setFilteringMode && this.api.asc_setFilteringMode(storeAppOptions.canModifyFilter);
}
onNeedUpdateExternalReference() {
const { t } = this.props;
f7.dialog.create({
title: t('Controller.Main.notcriticalErrorTitle'),
text: t('Controller.Main.textWarnUpdateExternalData'),
button: [
buttons: [
{
text: t('Controller.Main.textUpdate'),
onClick: () => {

View File

@ -2,6 +2,7 @@ import React, { Component } from "react";
import { ApplicationSettings } from "../../view/settings/ApplicationSettings";
import {observer, inject} from "mobx-react";
import { LocalStorage } from '../../../../../common/mobile/utils/LocalStorage.mjs';
import { withTranslation } from 'react-i18next';
import {FunctionGroups} from '../../controller/add/AddFunction';
class ApplicationSettingsController extends Component {
@ -11,9 +12,36 @@ class ApplicationSettingsController extends Component {
this.onChangeDisplayComments = this.onChangeDisplayComments.bind(this);
this.onRegSettings = this.onRegSettings.bind(this);
this.initRegSettings = this.initRegSettings.bind(this);
this.initFormulaLangsCollection = this.initFormulaLangsCollection.bind(this);
this.props.storeApplicationSettings.initRegData();
this.initRegSettings();
this.props.storeApplicationSettings.changeUnitMeasurement(Common.Utils.Metric.getCurrentMetric());
this.props.storeApplicationSettings.setFormulaLangsCollection(this.initFormulaLangsCollection());
}
initFormulaLangsCollection() {
const { t } = this.props;
const _t = t("View.Settings", { returnObjects: true });
const storeApplicationSettings = this.props.storeApplicationSettings;
const formulaLangs = storeApplicationSettings.formulaLangs;
const formulaLangsCollection = formulaLangs.map(lang => {
let str = lang.replace(/[\-_]/, '');
str = str.charAt(0).toUpperCase() + str.substring(1, str.length);
return {
value: lang,
displayValue: _t[`txt${str}lang`] ? t(`View.Settings.txt${str}lang`) : t(`View.Settings.txt${str}`), exampleValue: _t[`txtExample${str}`] ? t(`View.Settings.txtExample${str}`) : t('View.Settings.txtExampleEn')
}
});
formulaLangsCollection.sort(function(a, b){
if (a.displayValue < b.displayValue) return -1;
if (a.displayValue > b.displayValue) return 1;
return 0;
});
return formulaLangsCollection;
}
initRegSettings() {
@ -111,4 +139,4 @@ class ApplicationSettingsController extends Component {
}
export default inject("storeApplicationSettings", "storeAppOptions")(observer(ApplicationSettingsController));
export default inject("storeApplicationSettings", "storeAppOptions")(observer(withTranslation()(ApplicationSettingsController)));

View File

@ -26,7 +26,9 @@ export class storeApplicationSettings {
changeRefStyle: action,
changeFormulaLang: action,
directionMode: observable,
changeDirectionMode: action
changeDirectionMode: action,
formulaLangsColection: observable,
setFormulaLangsCollection: action
});
}
@ -34,30 +36,22 @@ export class storeApplicationSettings {
unitMeasurement = Common.Utils.Metric.getCurrentMetric();
macrosMode = 0;
macrosRequest = 0;
formulaLang = LocalStorage.getItem('sse-settings-func-lang') || this.getFormulaLanguages()[0].value;
formulaLang = LocalStorage.getItem('sse-settings-func-lang') || 'en';
regCode = undefined;
regExample = '';
regData = [];
isRefStyle = false;
isComments = true;
isResolvedComments = true;
formulaLangs = ['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'];
formulaLangsColection = [];
changeDirectionMode(value) {
this.directionMode = value;
}
getFormulaLanguages() {
const dataLang = [
{ value: 'en', displayValue: 'English', exampleValue: ' SUM; MIN; MAX; COUNT' },
{ value: 'de', displayValue: 'Deutsch', exampleValue: ' SUMME; MIN; MAX; ANZAHL' },
{ value: 'es', displayValue: 'Spanish', exampleValue: ' SUMA; MIN; MAX; CALCULAR' },
{ value: 'fr', displayValue: 'French', exampleValue: ' SOMME; MIN; MAX; NB' },
{ value: 'it', displayValue: 'Italian', exampleValue: ' SOMMA; MIN; MAX; CONTA.NUMERI' },
{ value: 'ru', displayValue: 'Russian', exampleValue: ' СУММ; МИН; МАКС; СЧЁТ' },
{ value: 'pl', displayValue: 'Polish', exampleValue: ' SUMA; MIN; MAX; ILE.LICZB' }
]
return dataLang;
setFormulaLangsCollection(arr) {
this.formulaLangsColection = arr;
}
getRegDataCodes() {

View File

@ -13,8 +13,8 @@ const PageApplicationSettings = props => {
const regData = storeApplicationSettings.regData;
const regCode = storeApplicationSettings.regCode;
const regExample = storeApplicationSettings.regExample;
const dataLang = storeApplicationSettings.getFormulaLanguages();
const defineFormulaLang = () => dataLang.find(obj => obj.value === formulaLang);
const formulaLangsColection = storeApplicationSettings.formulaLangsColection;
const defineFormulaLang = () => formulaLangsColection.find(obj => obj.value === formulaLang);
const currentFormulaLang = defineFormulaLang();
const defineRegSetting = () => regData.find(obj => regCode === obj.code);
const currentRegSetting = defineRegSetting();
@ -178,14 +178,14 @@ const PageFormulaLanguage = props => {
const { t } = useTranslation();
const _t = t("View.Settings", { returnObjects: true });
const storeApplicationSettings = props.storeApplicationSettings;
const formulaLangsColection = storeApplicationSettings.formulaLangsColection;
const formulaLang = storeApplicationSettings.formulaLang;
const dataLang = storeApplicationSettings.getFormulaLanguages();
return (
<Page>
<Navbar title={_t.textFormulaLanguage} backLink={_t.textBack} />
<List mediaList>
{dataLang.map((elem, index) => {
{formulaLangsColection.map((elem, index) => {
return (
<ListItem radio key={index} title={elem.displayValue} subtitle={`${t('View.Settings.textExample')}: ${elem.exampleValue}`} checked={elem.value === formulaLang}
onChange={() => {