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

Side by Side Diff: chrome/browser/resources/print_preview/print_header.js

Issue 2131603002: Print preview: make page/sheet summary locale aware (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Creates a PrintHeader object. This object encapsulates all the elements 9 * Creates a PrintHeader object. This object encapsulates all the elements
10 * and logic related to the top part of the left pane in print_preview.html. 10 * and logic related to the top part of the left pane in print_preview.html.
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 numPages *= copies; 181 numPages *= copies;
182 182
183 if (numSheets > 1) { 183 if (numSheets > 1) {
184 summaryLabel = saveToPdf ? pagesLabel : 184 summaryLabel = saveToPdf ? pagesLabel :
185 loadTimeData.getString('printPreviewSheetsLabelPlural'); 185 loadTimeData.getString('printPreviewSheetsLabelPlural');
186 } 186 }
187 187
188 var html; 188 var html;
189 var label; 189 var label;
190 if (numPages != numSheets) { 190 if (numPages != numSheets) {
191 html = loadTimeData.getStringF('printPreviewSummaryFormatLong', 191 html = loadTimeData.getStringF(
192 '<b>' + numSheets + '</b>', 192 'printPreviewSummaryFormatLong',
193 '<b>' + summaryLabel + '</b>', 193 '<b>' + numSheets.toLocaleString() + '</b>',
194 numPages, 194 '<b>' + summaryLabel + '</b>',
195 pagesLabel); 195 numPages.toLocaleString(),
196 pagesLabel);
196 label = loadTimeData.getStringF('printPreviewSummaryFormatLong', 197 label = loadTimeData.getStringF('printPreviewSummaryFormatLong',
197 numSheets, summaryLabel, 198 numSheets.toLocaleString(),
198 numPages, pagesLabel); 199 summaryLabel,
200 numPages.toLocaleString(),
201 pagesLabel);
199 } else { 202 } else {
200 html = loadTimeData.getStringF('printPreviewSummaryFormatShort', 203 html = loadTimeData.getStringF(
201 '<b>' + numSheets + '</b>', 204 'printPreviewSummaryFormatShort',
202 '<b>' + summaryLabel + '</b>'); 205 '<b>' + numSheets.toLocaleString() + '</b>',
206 '<b>' + summaryLabel + '</b>');
203 label = loadTimeData.getStringF('printPreviewSummaryFormatShort', 207 label = loadTimeData.getStringF('printPreviewSummaryFormatShort',
204 numSheets, summaryLabel); 208 numSheets.toLocaleString(),
209 summaryLabel);
205 } 210 }
206 211
207 // Removing extra spaces from within the string. 212 // Removing extra spaces from within the string.
208 html = html.replace(/\s{2,}/g, ' '); 213 html = html.replace(/\s{2,}/g, ' ');
209 214
210 var summary = this.getChildElement('.summary'); 215 var summary = this.getChildElement('.summary');
211 summary.innerHTML = html; 216 summary.innerHTML = html;
212 summary.setAttribute('aria-label', label); 217 summary.setAttribute('aria-label', label);
213 }, 218 },
214 219
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 this.getChildElement('button.print').focus(); 275 this.getChildElement('button.print').focus();
271 } 276 }
272 } 277 }
273 }; 278 };
274 279
275 // Export 280 // Export
276 return { 281 return {
277 PrintHeader: PrintHeader 282 PrintHeader: PrintHeader
278 }; 283 };
279 }); 284 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698