From 585307b4e63039afd96f37dd1594c290f52811d4 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Wed, 8 Feb 2023 14:20:56 +0400 Subject: [PATCH 1/3] [SSE mobile] For Bug 60297 --- apps/spreadsheeteditor/mobile/src/controller/Main.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx index f7fd8cf158..eacaaae511 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx @@ -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: () => { From 9b20225ff5ff3ddc34682a5f99bfd5826f3ddc4c Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Wed, 8 Feb 2023 16:18:32 +0400 Subject: [PATCH 2/3] [SSE mobile] Updated formule languages --- apps/spreadsheeteditor/mobile/locale/en.json | 55 ++++++++++++++++++- .../settings/ApplicationSettings.jsx | 30 +++++++++- .../mobile/src/store/applicationSettings.js | 22 +++----- .../src/view/settings/ApplicationSettings.jsx | 8 +-- 4 files changed, 95 insertions(+), 20 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index 643e332286..c89f7a83e1 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -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.
Are you sure you want to continue?" + "warnDownloadAs": "If you continue saving in this format all features except the text will be lost.
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" } } } \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/src/controller/settings/ApplicationSettings.jsx b/apps/spreadsheeteditor/mobile/src/controller/settings/ApplicationSettings.jsx index 049a1142e3..ef801da9b1 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/settings/ApplicationSettings.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/settings/ApplicationSettings.jsx @@ -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.initFormuleLangsCollection = this.initFormuleLangsCollection.bind(this); + this.props.storeApplicationSettings.initRegData(); this.initRegSettings(); this.props.storeApplicationSettings.changeUnitMeasurement(Common.Utils.Metric.getCurrentMetric()); + this.props.storeApplicationSettings.setFormuleLangsCollection(this.initFormuleLangsCollection()); + } + + initFormuleLangsCollection() { + const { t } = this.props; + const _t = t("View.Settings", { returnObjects: true }); + const storeApplicationSettings = this.props.storeApplicationSettings; + const formuleLangs = storeApplicationSettings.formuleLangs; + const formuleLangsCollection = formuleLangs.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') + } + }); + + formuleLangsCollection.sort(function(a, b){ + if (a.displayValue < b.displayValue) return -1; + if (a.displayValue > b.displayValue) return 1; + return 0; + }); + + return formuleLangsCollection; } initRegSettings() { @@ -111,4 +139,4 @@ class ApplicationSettingsController extends Component { } -export default inject("storeApplicationSettings", "storeAppOptions")(observer(ApplicationSettingsController)); \ No newline at end of file +export default inject("storeApplicationSettings", "storeAppOptions")(observer(withTranslation()(ApplicationSettingsController))); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/src/store/applicationSettings.js b/apps/spreadsheeteditor/mobile/src/store/applicationSettings.js index 2725581669..747f2866b5 100644 --- a/apps/spreadsheeteditor/mobile/src/store/applicationSettings.js +++ b/apps/spreadsheeteditor/mobile/src/store/applicationSettings.js @@ -26,7 +26,9 @@ export class storeApplicationSettings { changeRefStyle: action, changeFormulaLang: action, directionMode: observable, - changeDirectionMode: action + changeDirectionMode: action, + formuleLangsColection: observable, + setFormuleLangsCollection: 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; + formuleLangs = ['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']; + formuleLangsColection = []; 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; + setFormuleLangsCollection(arr) { + this.formuleLangsColection = arr; } getRegDataCodes() { diff --git a/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx b/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx index bb20c58977..83adc04bc6 100644 --- a/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx @@ -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 formuleLangsColection = storeApplicationSettings.formuleLangsColection; + const defineFormulaLang = () => formuleLangsColection.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 formuleLangsColection = storeApplicationSettings.formuleLangsColection; const formulaLang = storeApplicationSettings.formulaLang; - const dataLang = storeApplicationSettings.getFormulaLanguages(); return ( - {dataLang.map((elem, index) => { + {formuleLangsColection.map((elem, index) => { return ( { From 0bd405cb78c86e6113b2682e1023043be4a8014d Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Wed, 8 Feb 2023 18:34:22 +0400 Subject: [PATCH 3/3] [SSE mobile] Corrected variable names --- .../controller/settings/ApplicationSettings.jsx | 14 +++++++------- .../mobile/src/store/applicationSettings.js | 12 ++++++------ .../src/view/settings/ApplicationSettings.jsx | 8 ++++---- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/controller/settings/ApplicationSettings.jsx b/apps/spreadsheeteditor/mobile/src/controller/settings/ApplicationSettings.jsx index ef801da9b1..8db569867f 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/settings/ApplicationSettings.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/settings/ApplicationSettings.jsx @@ -12,20 +12,20 @@ class ApplicationSettingsController extends Component { this.onChangeDisplayComments = this.onChangeDisplayComments.bind(this); this.onRegSettings = this.onRegSettings.bind(this); this.initRegSettings = this.initRegSettings.bind(this); - this.initFormuleLangsCollection = this.initFormuleLangsCollection.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.setFormuleLangsCollection(this.initFormuleLangsCollection()); + this.props.storeApplicationSettings.setFormulaLangsCollection(this.initFormulaLangsCollection()); } - initFormuleLangsCollection() { + initFormulaLangsCollection() { const { t } = this.props; const _t = t("View.Settings", { returnObjects: true }); const storeApplicationSettings = this.props.storeApplicationSettings; - const formuleLangs = storeApplicationSettings.formuleLangs; - const formuleLangsCollection = formuleLangs.map(lang => { + const formulaLangs = storeApplicationSettings.formulaLangs; + const formulaLangsCollection = formulaLangs.map(lang => { let str = lang.replace(/[\-_]/, ''); str = str.charAt(0).toUpperCase() + str.substring(1, str.length); @@ -35,13 +35,13 @@ class ApplicationSettingsController extends Component { } }); - formuleLangsCollection.sort(function(a, b){ + formulaLangsCollection.sort(function(a, b){ if (a.displayValue < b.displayValue) return -1; if (a.displayValue > b.displayValue) return 1; return 0; }); - return formuleLangsCollection; + return formulaLangsCollection; } initRegSettings() { diff --git a/apps/spreadsheeteditor/mobile/src/store/applicationSettings.js b/apps/spreadsheeteditor/mobile/src/store/applicationSettings.js index 747f2866b5..61945b0867 100644 --- a/apps/spreadsheeteditor/mobile/src/store/applicationSettings.js +++ b/apps/spreadsheeteditor/mobile/src/store/applicationSettings.js @@ -27,8 +27,8 @@ export class storeApplicationSettings { changeFormulaLang: action, directionMode: observable, changeDirectionMode: action, - formuleLangsColection: observable, - setFormuleLangsCollection: action + formulaLangsColection: observable, + setFormulaLangsCollection: action }); } @@ -43,15 +43,15 @@ export class storeApplicationSettings { isRefStyle = false; isComments = true; isResolvedComments = true; - formuleLangs = ['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']; - formuleLangsColection = []; + 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; } - setFormuleLangsCollection(arr) { - this.formuleLangsColection = arr; + setFormulaLangsCollection(arr) { + this.formulaLangsColection = arr; } getRegDataCodes() { diff --git a/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx b/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx index 83adc04bc6..58e1ef23a7 100644 --- a/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/settings/ApplicationSettings.jsx @@ -13,8 +13,8 @@ const PageApplicationSettings = props => { const regData = storeApplicationSettings.regData; const regCode = storeApplicationSettings.regCode; const regExample = storeApplicationSettings.regExample; - const formuleLangsColection = storeApplicationSettings.formuleLangsColection; - const defineFormulaLang = () => formuleLangsColection.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 formuleLangsColection = storeApplicationSettings.formuleLangsColection; + const formulaLangsColection = storeApplicationSettings.formulaLangsColection; const formulaLang = storeApplicationSettings.formulaLang; return ( - {formuleLangsColection.map((elem, index) => { + {formulaLangsColection.map((elem, index) => { return ( {