Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: chrome/browser/resources/settings/about_page/about_page.js

Issue 2927213002: [MD settings] I18nBehavior return textContent from i18n() (Closed)
Patch Set: merge with master Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 'settings-about-page' contains version and OS related 6 * @fileoverview 'settings-about-page' contains version and OS related
7 * information. 7 * information.
8 */ 8 */
9 9
10 Polymer({ 10 Polymer({
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 }, 270 },
271 271
272 /** 272 /**
273 * @return {string} 273 * @return {string}
274 * @private 274 * @private
275 */ 275 */
276 getUpdateStatusMessage_: function() { 276 getUpdateStatusMessage_: function() {
277 switch (this.currentUpdateStatusEvent_.status) { 277 switch (this.currentUpdateStatusEvent_.status) {
278 case UpdateStatus.CHECKING: 278 case UpdateStatus.CHECKING:
279 case UpdateStatus.NEED_PERMISSION_TO_UPDATE: 279 case UpdateStatus.NEED_PERMISSION_TO_UPDATE:
280 return this.i18n('aboutUpgradeCheckStarted'); 280 return this.i18nAdvanced('aboutUpgradeCheckStarted');
281 case UpdateStatus.NEARLY_UPDATED: 281 case UpdateStatus.NEARLY_UPDATED:
282 // <if expr="chromeos"> 282 // <if expr="chromeos">
283 if (this.currentChannel_ != this.targetChannel_) 283 if (this.currentChannel_ != this.targetChannel_)
284 return this.i18n('aboutUpgradeSuccessChannelSwitch'); 284 return this.i18nAdvanced('aboutUpgradeSuccessChannelSwitch');
285 // </if> 285 // </if>
286 return this.i18n('aboutUpgradeRelaunch'); 286 return this.i18nAdvanced('aboutUpgradeRelaunch');
287 case UpdateStatus.UPDATED: 287 case UpdateStatus.UPDATED:
288 return this.i18n('aboutUpgradeUpToDate'); 288 return this.i18nAdvanced('aboutUpgradeUpToDate');
289 case UpdateStatus.UPDATING: 289 case UpdateStatus.UPDATING:
290 assert(typeof this.currentUpdateStatusEvent_.progress == 'number'); 290 assert(typeof this.currentUpdateStatusEvent_.progress == 'number');
291 var progressPercent = this.currentUpdateStatusEvent_.progress + '%'; 291 var progressPercent = this.currentUpdateStatusEvent_.progress + '%';
292 292
293 // <if expr="chromeos"> 293 // <if expr="chromeos">
294 if (this.currentChannel_ != this.targetChannel_) { 294 if (this.currentChannel_ != this.targetChannel_) {
295 return this.i18n( 295 return this.i18nAdvanced('aboutUpgradeUpdatingChannelSwitch', {
296 'aboutUpgradeUpdatingChannelSwitch', 296 substitutions: [
297 this.i18n(settings.browserChannelToI18nId(this.targetChannel_)), 297 this.i18nAdvanced(
298 progressPercent); 298 settings.browserChannelToI18nId(this.targetChannel_)),
299 progressPercent
300 ]
301 });
299 } 302 }
300 // </if> 303 // </if>
301 if (this.currentUpdateStatusEvent_.progress > 0) { 304 if (this.currentUpdateStatusEvent_.progress > 0) {
302 // NOTE(dbeam): some platforms (i.e. Mac) always send 0% while 305 // NOTE(dbeam): some platforms (i.e. Mac) always send 0% while
303 // updating (they don't support incremental upgrade progress). Though 306 // updating (they don't support incremental upgrade progress). Though
304 // it's certainly quite possible to validly end up here with 0% on 307 // it's certainly quite possible to validly end up here with 0% on
305 // platforms that support incremental progress, nobody really likes 308 // platforms that support incremental progress, nobody really likes
306 // seeing that they're 0% done with something. 309 // seeing that they're 0% done with something.
307 return this.i18n('aboutUpgradeUpdatingPercent', progressPercent); 310 return this.i18nAdvanced('aboutUpgradeUpdatingPercent', {
311 substitutions: [progressPercent],
312 });
308 } 313 }
309 return this.i18n('aboutUpgradeUpdating'); 314 return this.i18nAdvanced('aboutUpgradeUpdating');
310 default: 315 default:
311 function formatMessage(msg) { 316 function formatMessage(msg) {
312 return parseHtmlSubset( 317 return parseHtmlSubset(
313 '<b>' + msg + '</b>', ['br', 'pre']).firstChild.innerHTML; 318 '<b>' + msg + '</b>', ['br', 'pre']).firstChild.innerHTML;
314 } 319 }
315 var result = ''; 320 var result = '';
316 var message = this.currentUpdateStatusEvent_.message; 321 var message = this.currentUpdateStatusEvent_.message;
317 if (message) 322 if (message)
318 result += formatMessage(message); 323 result += formatMessage(message);
319 var connectMessage = this.currentUpdateStatusEvent_.connectionTypes; 324 var connectMessage = this.currentUpdateStatusEvent_.connectionTypes;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 }); 454 });
450 }, 455 },
451 456
452 // <if expr="_google_chrome"> 457 // <if expr="_google_chrome">
453 /** @private */ 458 /** @private */
454 onReportIssueTap_: function() { 459 onReportIssueTap_: function() {
455 this.aboutBrowserProxy_.openFeedbackDialog(); 460 this.aboutBrowserProxy_.openFeedbackDialog();
456 }, 461 },
457 // </if> 462 // </if>
458 }); 463 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698