From 145539326d7abdab57899326bbea265d2341c07f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 23 Jun 2017 10:25:30 +0300 Subject: [PATCH] [SSE, SSE mobile] Translate default cell styles. --- .../main/app/controller/Main.js | 52 ++++++++++++++++--- apps/spreadsheeteditor/main/locale/en.json | 22 ++++++++ apps/spreadsheeteditor/main/locale/ru.json | 9 ++++ .../mobile/app/controller/Main.js | 52 ++++++++++++++++--- apps/spreadsheeteditor/mobile/locale/en.json | 22 ++++++++ apps/spreadsheeteditor/mobile/locale/ru.json | 9 ++++ 6 files changed, 152 insertions(+), 14 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 5a18f13fb..243ac1d80 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -102,6 +102,7 @@ define([ onLaunch: function() { // $(document.body).css('position', 'absolute'); + var me = this; this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseWarning: false}; @@ -118,16 +119,32 @@ define([ if (value===null) value = window.devicePixelRatio > 1 ? '1' : '3'; // Initialize api - this.api = new Asc.spreadsheet_api({ - 'id-view' : 'editor_sdk', - 'id-input' : 'ce-cell-content', - 'translate': { + var styleNames = ['Normal', 'Neutral', 'Bad', 'Good', 'Input', 'Output', 'Calculation', 'Check Cell', 'Explanatory Text', 'Note', 'Linked Cell', 'Warning Text', + 'Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Title', 'Total', 'Currency', 'Percent', 'Comma'], + translate = { 'Series': this.txtSeries, 'Diagram Title': this.txtDiagramTitle, 'X Axis': this.txtXAxis, 'Y Axis': this.txtYAxis, 'Your text here': this.txtArt - } + }; + styleNames.forEach(function(item){ + translate[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item; + }); + translate['Currency [0]'] = me.txtStyle_Currency + ' [0]'; + translate['Comma [0]'] = me.txtStyle_Comma + ' [0]'; + + for (var i=1; i<7; i++) { + translate['Accent'+i] = me.txtAccent + i; + translate['20% - Accent'+i] = '20% - ' + me.txtAccent + i; + translate['40% - Accent'+i] = '40% - ' + me.txtAccent + i; + translate['60% - Accent'+i] = '60% - ' + me.txtAccent + i; + } + + this.api = new Asc.spreadsheet_api({ + 'id-view' : 'editor_sdk', + 'id-input' : 'ce-cell-content', + 'translate': translate }); this.api.asc_setFontRenderingMode(parseInt(value)); @@ -166,7 +183,6 @@ define([ this.getApplication().getController('Viewport').setApi(this.api); - var me = this; // Syncronize focus with api $(document.body).on('focus', 'input, textarea:not(#ce-cell-content)', function(e) { if (me.isAppDisabled === true) return; @@ -2124,7 +2140,29 @@ define([ errorSessionToken: 'The connection to the server has been interrupted. Please reload the page.', errorAccessDeny: 'You are trying to perform an action you do not have rights for.
Please contact your Document Server administrator.', titleServerVersion: 'Editor updated', - errorServerVersion: 'The editor version has been updated. The page will be reloaded to apply the changes.' + errorServerVersion: 'The editor version has been updated. The page will be reloaded to apply the changes.', + txtAccent: 'Accent', + txtStyle_Normal: 'Normal', + txtStyle_Heading_1: 'Heading 1', + txtStyle_Heading_2: 'Heading 2', + txtStyle_Heading_3: 'Heading 3', + txtStyle_Heading_4: 'Heading 4', + txtStyle_Title: 'Title', + txtStyle_Neutral: 'Neutral', + txtStyle_Bad: 'Bad', + txtStyle_Good: 'Good', + txtStyle_Input: 'Input', + txtStyle_Output: 'Output', + txtStyle_Calculation: 'Calculation', + txtStyle_Check_Cell: 'Check Cell', + txtStyle_Explanatory_Text: 'Explanatory Text', + txtStyle_Note: 'Note', + txtStyle_Linked_Cell: 'Linked Cell', + txtStyle_Warning_Text: 'Warning Text', + txtStyle_Total: 'Total', + txtStyle_Currency: 'Currency', + txtStyle_Percent: 'Percent', + txtStyle_Comma: 'Comma' } })(), SSE.Controllers.Main || {})) }); diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index c4f0cdf6e..b1927cecd 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -357,6 +357,28 @@ "SSE.Controllers.Main.warnLicenseExp": "Your license has expired.
Please update your license and refresh the page.", "SSE.Controllers.Main.warnNoLicense": "You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).
If you need more please consider purchasing a commercial license.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "SSE.Controllers.Main.txtAccent": "Accent", + "SSE.Controllers.Main.txtStyle_Normal": "Normal", + "SSE.Controllers.Main.txtStyle_Heading_1": "Heading 1", + "SSE.Controllers.Main.txtStyle_Heading_2": "Heading 2", + "SSE.Controllers.Main.txtStyle_Heading_3": "Heading 3", + "SSE.Controllers.Main.txtStyle_Heading_4": "Heading 4", + "SSE.Controllers.Main.txtStyle_Title": "Title", + "SSE.Controllers.Main.txtStyle_Neutral": "Neutral", + "SSE.Controllers.Main.txtStyle_Bad": "Bad", + "SSE.Controllers.Main.txtStyle_Good": "Good", + "SSE.Controllers.Main.txtStyle_Input": "Input", + "SSE.Controllers.Main.txtStyle_Output": "Output", + "SSE.Controllers.Main.txtStyle_Calculation": "Calculation", + "SSE.Controllers.Main.txtStyle_Check_Cell": "Check Cell", + "SSE.Controllers.Main.txtStyle_Explanatory_Text": "Explanatory Text", + "SSE.Controllers.Main.txtStyle_Note": "Note", + "SSE.Controllers.Main.txtStyle_Linked_Cell": "Linked Cell", + "SSE.Controllers.Main.txtStyle_Warning_Text": "Warning Text", + "SSE.Controllers.Main.txtStyle_Total": "Total", + "SSE.Controllers.Main.txtStyle_Currency": "Currency", + "SSE.Controllers.Main.txtStyle_Percent": "Percent", + "SSE.Controllers.Main.txtStyle_Comma": "Comma", "SSE.Controllers.Print.strAllSheets": "All Sheets", "SSE.Controllers.Print.textWarning": "Warning", "SSE.Controllers.Print.warnCheckMargings": "Margins are incorrect", diff --git a/apps/spreadsheeteditor/main/locale/ru.json b/apps/spreadsheeteditor/main/locale/ru.json index 08eec66e6..ff48beae6 100644 --- a/apps/spreadsheeteditor/main/locale/ru.json +++ b/apps/spreadsheeteditor/main/locale/ru.json @@ -357,6 +357,15 @@ "SSE.Controllers.Main.warnLicenseExp": "Истек срок действия лицензии.
Обновите лицензию, а затем обновите страницу.", "SSE.Controllers.Main.warnNoLicense": "Вы используете open source версию ONLYOFFICE. Эта версия имеет ограничения по количеству одновременных подключений к серверу документов (20 подключений одновременно).
Если требуется больше, рассмотрите вопрос о покупке коммерческой лицензии.", "SSE.Controllers.Main.warnProcessRightsChange": "Вам было отказано в праве на редактирование этого файла.", + "SSE.Controllers.Main.txtAccent": "Акцент", + "SSE.Controllers.Main.txtStyle_Normal": "Обычный", + "SSE.Controllers.Main.txtStyle_Heading_1": "Заголовок 1", + "SSE.Controllers.Main.txtStyle_Heading_2": "Заголовок 2", + "SSE.Controllers.Main.txtStyle_Heading_3": "Заголовок 3", + "SSE.Controllers.Main.txtStyle_Heading_4": "Заголовок 4", + "SSE.Controllers.Main.txtStyle_Currency": "Денежный", + "SSE.Controllers.Main.txtStyle_Percent": "Процентный", + "SSE.Controllers.Main.txtStyle_Comma": "Финансовый", "SSE.Controllers.Print.strAllSheets": "Все листы", "SSE.Controllers.Print.textWarning": "Предупреждение", "SSE.Controllers.Print.warnCheckMargings": "Неправильные поля", diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index 466f3f1b4..f7f07d3ea 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -96,17 +96,33 @@ define([ // window["flat_desine"] = true; - me.api = new Asc.spreadsheet_api({ - 'id-view' : 'editor_sdk', - 'id-input' : 'ce-cell-content' - ,'mobile' : true, - 'translate': { + var styleNames = ['Normal', 'Neutral', 'Bad', 'Good', 'Input', 'Output', 'Calculation', 'Check Cell', 'Explanatory Text', 'Note', 'Linked Cell', 'Warning Text', + 'Heading 1', 'Heading 2', 'Heading 3', 'Heading 4', 'Title', 'Total', 'Currency', 'Percent', 'Comma'], + translate = { 'Series': me.txtSeries, 'Diagram Title': me.txtDiagramTitle, 'X Axis': me.txtXAxis, 'Y Axis': me.txtYAxis, 'Your text here': me.txtArt - } + }; + styleNames.forEach(function(item){ + translate[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item; + }); + translate['Currency [0]'] = me.txtStyle_Currency + ' [0]'; + translate['Comma [0]'] = me.txtStyle_Comma + ' [0]'; + + for (var i=1; i<7; i++) { + translate['Accent'+i] = me.txtAccent + i; + translate['20% - Accent'+i] = '20% - ' + me.txtAccent + i; + translate['40% - Accent'+i] = '40% - ' + me.txtAccent + i; + translate['60% - Accent'+i] = '60% - ' + me.txtAccent + i; + } + + me.api = new Asc.spreadsheet_api({ + 'id-view' : 'editor_sdk', + 'id-input' : 'ce-cell-content' + ,'mobile' : true, + 'translate': translate }); // Localization uiApp params @@ -1358,7 +1374,29 @@ define([ textClose: 'Close', textDone: 'Done', titleServerVersion: 'Editor updated', - errorServerVersion: 'The editor version has been updated. The page will be reloaded to apply the changes.' + errorServerVersion: 'The editor version has been updated. The page will be reloaded to apply the changes.', + txtAccent: 'Accent', + txtStyle_Normal: 'Normal', + txtStyle_Heading_1: 'Heading 1', + txtStyle_Heading_2: 'Heading 2', + txtStyle_Heading_3: 'Heading 3', + txtStyle_Heading_4: 'Heading 4', + txtStyle_Title: 'Title', + txtStyle_Neutral: 'Neutral', + txtStyle_Bad: 'Bad', + txtStyle_Good: 'Good', + txtStyle_Input: 'Input', + txtStyle_Output: 'Output', + txtStyle_Calculation: 'Calculation', + txtStyle_Check_Cell: 'Check Cell', + txtStyle_Explanatory_Text: 'Explanatory Text', + txtStyle_Note: 'Note', + txtStyle_Linked_Cell: 'Linked Cell', + txtStyle_Warning_Text: 'Warning Text', + txtStyle_Total: 'Total', + txtStyle_Currency: 'Currency', + txtStyle_Percent: 'Percent', + txtStyle_Comma: 'Comma' } })(), SSE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json index f7d84b864..5568ee3ad 100644 --- a/apps/spreadsheeteditor/mobile/locale/en.json +++ b/apps/spreadsheeteditor/mobile/locale/en.json @@ -235,6 +235,28 @@ "SSE.Controllers.Main.warnLicenseExp": "Your license has expired.
Please update your license and refresh the page.", "SSE.Controllers.Main.warnNoLicense": "You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).
If you need more please consider purchasing a commercial license.", "SSE.Controllers.Main.warnProcessRightsChange": "You have been denied the right to edit the file.", + "SSE.Controllers.Main.txtAccent": "Accent", + "SSE.Controllers.Main.txtStyle_Normal": "Normal", + "SSE.Controllers.Main.txtStyle_Heading_1": "Heading 1", + "SSE.Controllers.Main.txtStyle_Heading_2": "Heading 2", + "SSE.Controllers.Main.txtStyle_Heading_3": "Heading 3", + "SSE.Controllers.Main.txtStyle_Heading_4": "Heading 4", + "SSE.Controllers.Main.txtStyle_Title": "Title", + "SSE.Controllers.Main.txtStyle_Neutral": "Neutral", + "SSE.Controllers.Main.txtStyle_Bad": "Bad", + "SSE.Controllers.Main.txtStyle_Good": "Good", + "SSE.Controllers.Main.txtStyle_Input": "Input", + "SSE.Controllers.Main.txtStyle_Output": "Output", + "SSE.Controllers.Main.txtStyle_Calculation": "Calculation", + "SSE.Controllers.Main.txtStyle_Check_Cell": "Check Cell", + "SSE.Controllers.Main.txtStyle_Explanatory_Text": "Explanatory Text", + "SSE.Controllers.Main.txtStyle_Note": "Note", + "SSE.Controllers.Main.txtStyle_Linked_Cell": "Linked Cell", + "SSE.Controllers.Main.txtStyle_Warning_Text": "Warning Text", + "SSE.Controllers.Main.txtStyle_Total": "Total", + "SSE.Controllers.Main.txtStyle_Currency": "Currency", + "SSE.Controllers.Main.txtStyle_Percent": "Percent", + "SSE.Controllers.Main.txtStyle_Comma": "Comma", "SSE.Controllers.Search.textNoTextFound": "Text not found", "SSE.Controllers.Search.textReplaceAll": "Replace All", "SSE.Controllers.Settings.notcriticalErrorTitle": "Warning", diff --git a/apps/spreadsheeteditor/mobile/locale/ru.json b/apps/spreadsheeteditor/mobile/locale/ru.json index 84f982db9..6f271f3e4 100644 --- a/apps/spreadsheeteditor/mobile/locale/ru.json +++ b/apps/spreadsheeteditor/mobile/locale/ru.json @@ -235,6 +235,15 @@ "SSE.Controllers.Main.warnLicenseExp": "Истек срок действия лицензии.
Обновите лицензию, а затем обновите страницу.", "SSE.Controllers.Main.warnNoLicense": "Вы используете open source версию ONLYOFFICE. Эта версия имеет ограничения по количеству одновременных подключений к серверу документов (20 подключений одновременно).
Если требуется больше, рассмотрите вопрос о покупке коммерческой лицензии.", "SSE.Controllers.Main.warnProcessRightsChange": "Вам было отказано в праве на редактирование этого файла.", + "SSE.Controllers.Main.txtAccent": "Акцент", + "SSE.Controllers.Main.txtStyle_Normal": "Обычный", + "SSE.Controllers.Main.txtStyle_Heading_1": "Заголовок 1", + "SSE.Controllers.Main.txtStyle_Heading_2": "Заголовок 2", + "SSE.Controllers.Main.txtStyle_Heading_3": "Заголовок 3", + "SSE.Controllers.Main.txtStyle_Heading_4": "Заголовок 4", + "SSE.Controllers.Main.txtStyle_Currency": "Денежный", + "SSE.Controllers.Main.txtStyle_Percent": "Процентный", + "SSE.Controllers.Main.txtStyle_Comma": "Финансовый", "SSE.Controllers.Search.textNoTextFound": "Текст не найден", "SSE.Controllers.Search.textReplaceAll": "Заменить все", "SSE.Controllers.Settings.notcriticalErrorTitle": "Внимание",