Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 1eaf340

Browse files
committed
Merge pull request #4260 from TomMalbran/tom/issue-4252
Fix #4252: Do not copy entire Strings Object; pass by reference instead
2 parents a8bc033 + f43f682 commit 1eaf340

File tree

10 files changed

+38
-34
lines changed

10 files changed

+38
-34
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<div class="switch-language modal">
22
<div class="modal-header">
33
<a href="#" class="close" data-dismiss="modal">&times;</a>
4-
<h1 class="dialog-title">{{LANGUAGE_TITLE}}</h1>
4+
<h1 class="dialog-title">{{Strings.LANGUAGE_TITLE}}</h1>
55
</div>
66
<div class="modal-body">
77
<p class="dialog-message">
8-
{{LANGUAGE_MESSAGE}}
8+
{{Strings.LANGUAGE_MESSAGE}}
99
<select>
1010
{{#languages}}
1111
<option value="{{language}}">{{label}}</option>
@@ -14,7 +14,7 @@ <h1 class="dialog-title">{{LANGUAGE_TITLE}}</h1>
1414
</p>
1515
</div>
1616
<div class="modal-footer">
17-
<button class="dialog-button btn primary" data-button-id="ok" disabled>{{LANGUAGE_SUBMIT}}</button>
18-
<button class="dialog-button btn left" data-button-id="cancel">{{CANCEL}}</button>
17+
<button class="dialog-button btn primary" data-button-id="ok" disabled>{{Strings.LANGUAGE_SUBMIT}}</button>
18+
<button class="dialog-button btn left" data-button-id="cancel">{{Strings.CANCEL}}</button>
1919
</div>
2020
</div>

src/extensions/default/DebugCommands/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ define(function (require, exports, module) {
187187
}
188188
});
189189

190-
var template = Mustache.render(LanguageDialogTemplate, $.extend({languages: languages}, Strings));
190+
var template = Mustache.render(LanguageDialogTemplate, {languages: languages, Strings: Strings});
191191
Dialogs.showModalDialogUsingTemplate(template).done(function () {
192192
if (locale === undefined) {
193193
return;

src/extensions/default/RecentProjects/htmlContent/projects-menu.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
</li>
99
{{/projectList}}
1010

11-
{{#hasProject}}
11+
{{#projectList.length}}
1212
<li class="divider"></li>
13-
{{/hasProject}}
13+
{{/projectList.length}}
1414

15-
<li><a id="open-folder-link">{{CMD_OPEN_FOLDER}}</a></li>
15+
<li><a id="open-folder-link">{{Strings.CMD_OPEN_FOLDER}}</a></li>
1616
</ul>

src/extensions/default/RecentProjects/main.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,16 +240,18 @@ define(function (require, exports, module) {
240240
function renderList() {
241241
var recentProjects = getRecentProjects(),
242242
currentProject = FileUtils.canonicalizeFolderPath(ProjectManager.getProjectRoot().fullPath),
243-
projectList = [];
243+
templateVars = {
244+
projectList : [],
245+
Strings : Strings
246+
};
244247

245248
recentProjects.forEach(function (root) {
246249
if (root !== currentProject) {
247-
projectList.push(parsePath(root));
250+
templateVars.projectList.push(parsePath(root));
248251
}
249252
});
250-
var templateVars = {projectList: projectList, hasProject: projectList.length};
251253

252-
return Mustache.render(ProjectsMenuTemplate, $.extend(templateVars, Strings));
254+
return Mustache.render(ProjectsMenuTemplate, templateVars);
253255
}
254256

255257
/**

src/extensions/default/WebPlatformDocs/InlineDocsViewer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ <h1>{{propName}}</h1>
1717
</div>
1818
</div>
1919
<div class="content-bottom"></div>
20-
<a class="more-info" href="{{url}}" title="{{url}}">{{DOCS_MORE_LINK}}</a>
20+
<a class="more-info" href="{{url}}" title="{{url}}">{{Strings.DOCS_MORE_LINK}}</a>
2121
</div>

src/extensions/default/WebPlatformDocs/InlineDocsViewer.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,13 @@ define(function (require, exports, module) {
5555
return { value: valueInfo.TITLE, description: valueInfo.DESCRIPTION };
5656
});
5757

58-
var templateVars = $.extend({
59-
propName: cssPropName,
60-
summary: cssPropDetails.SUMMARY,
61-
propValues: propValues,
62-
url: cssPropDetails.URL
63-
}, Strings);
58+
var templateVars = {
59+
propName : cssPropName,
60+
summary : cssPropDetails.SUMMARY,
61+
propValues : propValues,
62+
url : cssPropDetails.URL,
63+
Strings : Strings
64+
};
6465

6566
var html = Mustache.render(inlineEditorTemplate, templateVars);
6667

src/help/HelpCommandHandlers.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,12 @@ define(function (require, exports, module) {
6666
}
6767

6868
function _handleAboutDialog() {
69-
var templateVars = $.extend({
69+
var templateVars = {
7070
ABOUT_ICON : brackets.config.about_icon,
7171
APP_NAME_ABOUT_BOX : brackets.config.app_name_about,
72-
BUILD_INFO : buildInfo || ""
73-
}, Strings);
72+
BUILD_INFO : buildInfo || "",
73+
Strings : Strings
74+
};
7475

7576
Dialogs.showModalDialogUsingTemplate(Mustache.render(AboutDialogTemplate, templateVars));
7677

src/htmlContent/about-dialog.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
<div class="about-dialog modal">
22
<div class="modal-header">
3-
<h1 class="dialog-title">{{ABOUT}}</h1>
3+
<h1 class="dialog-title">{{Strings.ABOUT}}</h1>
44
</div>
55
<div class="modal-body">
66
<img class="about-icon" src="{{ABOUT_ICON}}">
77
<div class="about-text">
88
<h2>{{APP_NAME_ABOUT_BOX}}</h2>
99
<div class="about-info">
10-
<p class="dialog-message">{{ABOUT_TEXT_LINE1}} <span id="about-build-number">{{BUILD_INFO}}</span></p>
10+
<p class="dialog-message">{{Strings.ABOUT_TEXT_LINE1}} <span id="about-build-number">{{BUILD_INFO}}</span></p>
1111
<p class="dialog-message"><!-- $NON-NLS$ -->Copyright 2012 - 2013 Adobe Systems Incorporated and its licensors. All rights reserved.</p>
12-
<p class="dialog-message">{{{ABOUT_TEXT_WEB_PLATFORM_DOCS}}}</p>
13-
<p class="dialog-message">{{{ABOUT_TEXT_LINE3}}}</p>
14-
<p class="dialog-message">{{{ABOUT_TEXT_LINE4}}}</p>
12+
<p class="dialog-message">{{{Strings.ABOUT_TEXT_WEB_PLATFORM_DOCS}}}</p>
13+
<p class="dialog-message">{{{Strings.ABOUT_TEXT_LINE3}}}</p>
14+
<p class="dialog-message">{{{Strings.ABOUT_TEXT_LINE4}}}</p>
1515
<p class="dialog-message">
16-
{{ABOUT_TEXT_LINE5}}
16+
{{Strings.ABOUT_TEXT_LINE5}}
1717
<span class="spinner"></span>
1818
</p>
1919
<div class="about-contributors">
@@ -22,6 +22,6 @@ <h2>{{APP_NAME_ABOUT_BOX}}</h2>
2222
</div>
2323
</div>
2424
<div class="modal-footer">
25-
<button class="dialog-button btn primary" data-button-id="ok">{{CLOSE}}</button>
25+
<button class="dialog-button btn primary" data-button-id="ok">{{Strings.CLOSE}}</button>
2626
</div>
2727
</div>

src/htmlContent/update-list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{#.}}
22
<div>
3-
<h3>{{versionString}} - {{dateString}} (<a href="#" data-url="{{releaseNotesURL}}">{{RELEASE_NOTES}}</a>)</h3>
3+
<h3>{{versionString}} - {{dateString}} (<a href="#" data-url="{{releaseNotesURL}}">{{Strings.RELEASE_NOTES}}</a>)</h3>
44
<ul>
55
{{#newFeatures}}
66
<li><b>{{name}}</b> - {{description}}</li>

src/utils/UpdateNotification.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,11 @@ define(function (require, exports, module) {
203203
});
204204

205205
// Populate the update data
206-
var $dlg = $(".update-dialog.instance");
207-
var $updateList = $dlg.find(".update-info");
208-
var templateVars = $.extend(updates, Strings);
206+
var $dlg = $(".update-dialog.instance"),
207+
$updateList = $dlg.find(".update-info");
209208

210-
$updateList.html(Mustache.render(UpdateListTemplate, templateVars));
209+
updates.Strings = Strings;
210+
$updateList.html(Mustache.render(UpdateListTemplate, updates));
211211

212212
$dlg.on("click", "a", function (e) {
213213
var url = $(e.currentTarget).attr("data-url");

0 commit comments

Comments
 (0)