From c0507f77495c085bf27dd47fae688b178ab24028 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 18 Sep 2019 18:12:50 +0300 Subject: [PATCH] [DE] Refactoring for localization --- apps/common/locale.js | 4 +- apps/documenteditor/main/app/view/Toolbar.js | 4 +- apps/documenteditor/main/app_dev.js | 80 ++++++++++---------- 3 files changed, 43 insertions(+), 45 deletions(-) diff --git a/apps/common/locale.js b/apps/common/locale.js index e7ce8cd71..f3eb7b94d 100644 --- a/apps/common/locale.js +++ b/apps/common/locale.js @@ -56,8 +56,8 @@ Common.Locale = new(function() { obj = obj[p[i]]; } - if (obj) { - obj[p[p.length - 1]] = l10n[prop]; + if (obj && obj.prototype) { + obj.prototype[p[p.length - 1]] = l10n[prop]; } } } diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index ade6b68a7..10477269f 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -62,7 +62,7 @@ define([ ], function ($, _, Backbone, template, template_view) { 'use strict'; - DE.Views.Toolbar = Common.UI.Mixtbar.extend(_.extend((function(){ + DE.Views.Toolbar = Common.UI.Mixtbar.extend((function(){ return { el: '#toolbar', @@ -2326,5 +2326,5 @@ define([ textRemWatermark: 'Remove Watermark', tipWatermark: 'Edit watermark' } - })(), DE.Views.Toolbar || {})); + })()); }); diff --git a/apps/documenteditor/main/app_dev.js b/apps/documenteditor/main/app_dev.js index ea9a07eba..8df0a9851 100644 --- a/apps/documenteditor/main/app_dev.js +++ b/apps/documenteditor/main/app_dev.js @@ -159,47 +159,45 @@ require([ ] }); - Common.Locale.apply( - function() { - require([ - 'documenteditor/main/app/controller/Viewport', - 'documenteditor/main/app/controller/DocumentHolder', - 'documenteditor/main/app/controller/Toolbar', - 'documenteditor/main/app/controller/Links', - 'documenteditor/main/app/controller/Navigation', - 'documenteditor/main/app/controller/Statusbar', - 'documenteditor/main/app/controller/RightMenu', - 'documenteditor/main/app/controller/LeftMenu', - 'documenteditor/main/app/controller/Main', - 'documenteditor/main/app/view/FileMenuPanels', - 'documenteditor/main/app/view/ParagraphSettings', - 'documenteditor/main/app/view/HeaderFooterSettings', - 'documenteditor/main/app/view/ImageSettings', - 'documenteditor/main/app/view/TableSettings', - 'documenteditor/main/app/view/ShapeSettings', - 'documenteditor/main/app/view/TextArtSettings', - 'documenteditor/main/app/view/SignatureSettings', - 'common/main/lib/util/utils', - 'common/main/lib/util/LocalStorage', - 'common/main/lib/controller/Fonts', - 'common/main/lib/controller/History' - /** coauthoring begin **/ - ,'common/main/lib/controller/Comments' - ,'common/main/lib/controller/Chat' - /** coauthoring end **/ - ,'common/main/lib/controller/Plugins' - ,'documenteditor/main/app/view/ChartSettings' - ,'common/main/lib/controller/ExternalDiagramEditor' - ,'common/main/lib/controller/ExternalMergeEditor' - ,'common/main/lib/controller/ReviewChanges' - ,'common/main/lib/controller/Protection' - ,'common/main/lib/controller/Desktop' - ], function() { - window.compareVersions = true; - app.start(); - }); - } - ); + require([ + 'documenteditor/main/app/controller/Viewport', + 'documenteditor/main/app/controller/DocumentHolder', + 'documenteditor/main/app/controller/Toolbar', + 'documenteditor/main/app/controller/Links', + 'documenteditor/main/app/controller/Navigation', + 'documenteditor/main/app/controller/Statusbar', + 'documenteditor/main/app/controller/RightMenu', + 'documenteditor/main/app/controller/LeftMenu', + 'documenteditor/main/app/controller/Main', + 'documenteditor/main/app/view/FileMenuPanels', + 'documenteditor/main/app/view/ParagraphSettings', + 'documenteditor/main/app/view/HeaderFooterSettings', + 'documenteditor/main/app/view/ImageSettings', + 'documenteditor/main/app/view/TableSettings', + 'documenteditor/main/app/view/ShapeSettings', + 'documenteditor/main/app/view/TextArtSettings', + 'documenteditor/main/app/view/SignatureSettings', + 'common/main/lib/util/utils', + 'common/main/lib/util/LocalStorage', + 'common/main/lib/controller/Fonts', + 'common/main/lib/controller/History' + /** coauthoring begin **/ + ,'common/main/lib/controller/Comments' + ,'common/main/lib/controller/Chat' + /** coauthoring end **/ + ,'common/main/lib/controller/Plugins' + ,'documenteditor/main/app/view/ChartSettings' + ,'common/main/lib/controller/ExternalDiagramEditor' + ,'common/main/lib/controller/ExternalMergeEditor' + ,'common/main/lib/controller/ReviewChanges' + ,'common/main/lib/controller/Protection' + ,'common/main/lib/controller/Desktop' + ], function() { + window.compareVersions = true; + Common.Locale.apply(function () { + app.start(); + }); + }); }, function(err) { if (err.requireType == 'timeout' && !reqerr && window.requireTimeourError) { reqerr = window.requireTimeourError();