diff --git a/apps/common/embed/lib/view/modals.js b/apps/common/embed/lib/view/modals.js index 4c9c02e07..030a8f4bc 100644 --- a/apps/common/embed/lib/view/modals.js +++ b/apps/common/embed/lib/view/modals.js @@ -61,10 +61,10 @@ common.view.modals = new(function() { ''; var _tplbody_embed = '
' + - 'Width:' + + '{width}:' + '' + '' + - 'Height:' + + '{height}:' + '
' + ''; @@ -75,22 +75,29 @@ common.view.modals = new(function() { var _$dlg; if (name == 'share') { _$dlg = $(tplDialog - .replace(/\{title}/, 'Share Link') + .replace(/\{title}/, this.txtShare) .replace(/\{body}/, _tplbody_share) - .replace(/\{footer}/, '')) + .replace(/\{footer}/, '')) .appendTo(parent) .attr('id', 'dlg-share'); } else if (name == 'embed') { _$dlg = $(tplDialog - .replace(/\{title}/, 'Embed') + .replace(/\{title}/, this.txtEmbed) .replace(/\{body}/, _tplbody_embed) - .replace(/\{footer}/, '')) + .replace(/\{width}/, this.txtWidth) + .replace(/\{height}/, this.txtHeight) + .replace(/\{footer}/, '')) .appendTo(parent) .attr('id', 'dlg-embed'); } return _$dlg; - } + }, + txtWidth: 'Width', + txtHeight: 'Height', + txtShare: 'Share Link', + txtCopy: 'Copy to clipboard', + txtEmbed: 'Embed' }; })(); diff --git a/apps/documenteditor/embed/index.html b/apps/documenteditor/embed/index.html index 5a37da3b2..a62077848 100644 --- a/apps/documenteditor/embed/index.html +++ b/apps/documenteditor/embed/index.html @@ -330,6 +330,7 @@ + diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index ddd62ba94..e4a188ab6 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -30,7 +30,7 @@ * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ -var ApplicationController = new(function(){ +DE.ApplicationController = new(function(){ var me, api, config = {}, @@ -51,7 +51,7 @@ var ApplicationController = new(function(){ // ------------------------- if (typeof isBrowserSupported !== 'undefined' && !isBrowserSupported()){ - Common.Gateway.reportError(undefined, 'Your browser is not supported.'); + Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText); return; } @@ -122,7 +122,7 @@ var ApplicationController = new(function(){ function onCountPages(count) { maxPages = count; - $('#pages').text('of ' + count); + $('#pages').text(me.textOf + " " + count); } function onCurrentPage(number) { @@ -134,10 +134,10 @@ var ApplicationController = new(function(){ switch (id) { case Asc.c_oAscAsyncAction['Print']: - text = 'Downloading document...'; + text = me.downloadTextText; break; default: - text = 'Please wait...'; + text = me.waitText; break; } @@ -248,12 +248,12 @@ var ApplicationController = new(function(){ Common.Gateway.on('processmouse', onProcessMouse); Common.Gateway.on('downloadas', onDownloadAs); - ApplicationView.tools.get('#idt-fullscreen') + DE.ApplicationView.tools.get('#idt-fullscreen') .on('click', function(){ common.utils.openLink(embedConfig.fullscreenUrl); }); - ApplicationView.tools.get('#idt-download') + DE.ApplicationView.tools.get('#idt-download') .on('click', function(){ if ( !!embedConfig.saveUrl ){ common.utils.openLink(embedConfig.saveUrl); @@ -354,14 +354,14 @@ var ApplicationController = new(function(){ function onOpenDocument(progress) { var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount()); - $('#loadmask-text').html('Loading document: ' + Math.min(Math.round(proc * 100), 100) + '%'); + $('#loadmask-text').html(me.textLoadingDocument + ': ' + + Math.min(Math.round(proc * 100), 100) + '%'); } function onError(id, level, errData) { if (id == Asc.c_oAscError.ID.LoadingScriptError) { $('#id-critical-error-title').text(me.criticalErrorTitle); $('#id-critical-error-message').text(me.scriptLoadError); - $('#id-critical-error-close').off().on('click', function(){ + $('#id-critical-error-close').text(me.txtClose).off().on('click', function(){ window.location.reload(); }); $('#id-critical-error-dialog').css('z-index', 20002).modal('show'); @@ -410,8 +410,7 @@ var ApplicationController = new(function(){ $('#id-critical-error-title').text(me.criticalErrorTitle); $('#id-critical-error-message').text(message); - $('#id-critical-error-close').off(); - $('#id-critical-error-close').on('click', function(){ + $('#id-critical-error-close').text(me.txtClose).off().on('click', function(){ window.location.reload(); }); } @@ -420,8 +419,7 @@ var ApplicationController = new(function(){ $('#id-critical-error-title').text(me.notcriticalErrorTitle); $('#id-critical-error-message').text(message); - $('#id-critical-error-close').off(); - $('#id-critical-error-close').on('click', function(){ + $('#id-critical-error-close').text(me.txtClose).off().on('click', function(){ $('#id-critical-error-dialog').modal('hide'); }); } @@ -434,7 +432,7 @@ var ApplicationController = new(function(){ function onExternalMessage(error) { if (error) { hidePreloader(); - $('#id-error-mask-title').text('Error'); + $('#id-error-mask-title').text(me.criticalErrorTitle); $('#id-error-mask-text').text(error.msg); $('#id-error-mask').css('display', 'block'); @@ -549,6 +547,12 @@ var ApplicationController = new(function(){ scriptLoadError: 'The connection is too slow, some of the components could not be loaded. Please reload the page.', errorFilePassProtect: 'The file is password protected and cannot be opened.', errorAccessDeny: 'You are trying to perform an action you do not have rights for.
Please contact your Document Server administrator.', - errorUserDrop: 'The file cannot be accessed right now.' + errorUserDrop: 'The file cannot be accessed right now.', + unsupportedBrowserErrorText: 'Your browser is not supported.', + textOf: 'of', + downloadTextText: 'Downloading document...', + waitText: 'Please, wait...', + textLoadingDocument: 'Loading document', + txtClose: 'Close' } })(); \ No newline at end of file diff --git a/apps/documenteditor/embed/js/ApplicationView.js b/apps/documenteditor/embed/js/ApplicationView.js index 41fb404d8..1c3aca46f 100644 --- a/apps/documenteditor/embed/js/ApplicationView.js +++ b/apps/documenteditor/embed/js/ApplicationView.js @@ -30,7 +30,11 @@ * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ -var ApplicationView = new(function(){ +if (DE === undefined) { + var DE = {}; +} + +DE.ApplicationView = new(function(){ var $btnTools; // Initialize view @@ -41,10 +45,10 @@ var ApplicationView = new(function(){ $btnTools.addClass('dropdown-toggle').attr('data-toggle', 'dropdown').attr('aria-expanded', 'true'); $btnTools.parent().append( ''); } @@ -56,6 +60,11 @@ var ApplicationView = new(function(){ create: createView , tools: { get: getTools - } + }, + + txtDownload: 'Download', + txtShare: 'Share', + txtEmbed: 'Embed', + txtFullScreen: 'Full Screen' } })(); diff --git a/apps/documenteditor/embed/js/application.js b/apps/documenteditor/embed/js/application.js index 785fd189e..9045fe155 100644 --- a/apps/documenteditor/embed/js/application.js +++ b/apps/documenteditor/embed/js/application.js @@ -31,6 +31,7 @@ * */ +function ($) { - ApplicationView.create(); - ApplicationController.create(); + Common.Locale.apply(); + DE.ApplicationView.create(); + DE.ApplicationController.create(); }(); diff --git a/apps/documenteditor/embed/locale/en.json b/apps/documenteditor/embed/locale/en.json new file mode 100644 index 000000000..7ee13767a --- /dev/null +++ b/apps/documenteditor/embed/locale/en.json @@ -0,0 +1,26 @@ +{ + "common.view.modals.txtWidth": "Width", + "common.view.modals.txtHeight": "Height", + "common.view.modals.txtShare": "Share Link", + "common.view.modals.txtCopy": "Copy to clipboard", + "common.view.modals.txtEmbed": "Embed", + "DE.ApplicationView.txtDownload": "Download", + "DE.ApplicationView.txtShare": "Share", + "DE.ApplicationView.txtEmbed": "Embed", + "DE.ApplicationView.txtFullScreen": "Full Screen", + "DE.ApplicationController.errorDefaultMessage": "Error code: %1", + "DE.ApplicationController.unknownErrorText": "Unknown error.", + "DE.ApplicationController.convertationTimeoutText": "Convertation timeout exceeded.", + "DE.ApplicationController.convertationErrorText": "Convertation failed.", + "DE.ApplicationController.downloadErrorText": "Download failed.", + "DE.ApplicationController.criticalErrorTitle": "Error", + "DE.ApplicationController.notcriticalErrorTitle": "Warning", + "DE.ApplicationController.scriptLoadError": "The connection is too slow, some of the components could not be loaded. Please reload the page.", + "DE.ApplicationController.errorFilePassProtect": "The file is password protected and cannot be opened.", + "DE.ApplicationController.errorAccessDeny": "You are trying to perform an action you do not have rights for.
Please contact your Document Server administrator.", + "DE.ApplicationController.errorUserDrop": "The file cannot be accessed right now.", + "DE.ApplicationController.textOf": "of", + "DE.ApplicationController.unsupportedBrowserErrorText": "Your browser is not supported.", + "DE.ApplicationController.textLoadingDocument": "Loading document", + "DE.ApplicationController.txtClose": "Close" +} \ No newline at end of file diff --git a/apps/documenteditor/embed/locale/ru.json b/apps/documenteditor/embed/locale/ru.json new file mode 100644 index 000000000..2acc61004 --- /dev/null +++ b/apps/documenteditor/embed/locale/ru.json @@ -0,0 +1,25 @@ +{ + "common.view.modals.txtWidth": "Ширина", + "common.view.modals.txtHeight": "Высота", + "common.view.modals.txtShare": "Поделиться ссылкой", + "common.view.modals.txtCopy": "Скопировать в буфер", + "common.view.modals.txtEmbed": "Встроить", + "DE.ApplicationView.txtDownload": "Скачать файл", + "DE.ApplicationView.txtShare": "Поделиться", + "DE.ApplicationView.txtEmbed": "Встроить", + "DE.ApplicationView.txtFullScreen": "Во весь экран", + "DE.ApplicationController.errorDefaultMessage": "Код ошибки: %1", + "DE.ApplicationController.unknownErrorText": "Неизвестная ошибка.", + "DE.ApplicationController.convertationTimeoutText": "Превышено время ожидания конвертации.", + "DE.ApplicationController.convertationErrorText": "Конвертация не удалась.", + "DE.ApplicationController.downloadErrorText": "Загрузка не удалась.", + "DE.ApplicationController.criticalErrorTitle": "Ошибка", + "DE.ApplicationController.notcriticalErrorTitle": "Внимание", + "DE.ApplicationController.scriptLoadError": "Слишком медленное подключение, некоторые компоненты не удалось загрузить. Пожалуйста, обновите страницу.", + "DE.ApplicationController.errorFilePassProtect": "Файл защищен паролем и не может быть открыт.", + "DE.ApplicationController.errorAccessDeny": "Вы пытаетесь выполнить действие, на которое у вас нет прав.
Пожалуйста, обратитесь к администратору Сервера документов.", + "DE.ApplicationController.errorUserDrop": "В настоящий момент файл недоступен.", + "DE.ApplicationController.textOf": "из", + "DE.ApplicationController.textLoadingDocument": "Загрузка документа", + "DE.ApplicationController.txtClose": "Закрыть" +} \ No newline at end of file diff --git a/build/Gruntfile.js b/build/Gruntfile.js index f65b78b84..0f0923459 100644 --- a/build/Gruntfile.js +++ b/build/Gruntfile.js @@ -404,6 +404,9 @@ module.exports = function(grunt) { }, copy: { + localization: { + files: packageFile['embed']['copy']['localization'] + }, 'index-page': { files: packageFile['embed']['copy']['index-page'] }, diff --git a/build/documenteditor.json b/build/documenteditor.json index 99f4f09b2..50a89586e 100644 --- a/build/documenteditor.json +++ b/build/documenteditor.json @@ -368,6 +368,7 @@ }, "js": { "src": [ + "../apps/common/locale.js", "../apps/common/Gateway.js", "../apps/common/Analytics.js", "../apps/common/embed/lib/util/utils.js", @@ -386,6 +387,14 @@ } }, "copy": { + "localization": [ + { + "expand": true, + "cwd": "../apps/documenteditor/embed/locale/", + "src": "*", + "dest": "../deploy/web-apps/apps/documenteditor/embed/locale/" + } + ], "index-page": { "../deploy/web-apps/apps/documenteditor/embed/index.html": "../apps/documenteditor/embed/index.html.deploy" },