1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 23:28:06 +02:00

Tweak the pageSize l10n strings for the document properties dialog

The units are currently repeated after each dimension, which seems unnecessary and is also not done in other PDF viewers (such as e.g. Adobe Reader).

Furthermore, the name of the l10n arguments can be simplified slightly, since the name of the strings themselves should be enough information.

Finally, the `width`/`height` should be formatted according to the current locale, as is already done for other strings in the document properties dialog.
This commit is contained in:
Jonas Jenwald 2018-03-17 17:21:15 +01:00
parent e0ae157582
commit 1730447ca1
3 changed files with 21 additions and 14 deletions

View file

@ -228,15 +228,15 @@ class PDFDocumentProperties {
const { width, height, } = pageSizeInches;
return Promise.all([
this.l10n.get('document_properties_page_size_in', {
width_in: Math.round(width * 100) / 100,
height_in: Math.round(height * 100) / 100,
}, '{{width_in}}in × {{height_in}}in'),
this.l10n.get('document_properties_page_size_in_2', {
width: (Math.round(width * 100) / 100).toLocaleString(),
height: (Math.round(height * 100) / 100).toLocaleString(),
}, '{{width}} × {{height}} in'),
// 1in = 25.4mm; no need to round to 2 decimals for millimeters.
this.l10n.get('document_properties_page_size_mm', {
width_mm: Math.round(width * 25.4 * 10) / 10,
height_mm: Math.round(height * 25.4 * 10) / 10,
}, '{{width_mm}}mm × {{height_mm}}mm'),
this.l10n.get('document_properties_page_size_mm_2', {
width: (Math.round(width * 25.4 * 10) / 10).toLocaleString(),
height: (Math.round(height * 25.4 * 10) / 10).toLocaleString(),
}, '{{width}} × {{height}} mm'),
]).then((sizes) => {
return {
inch: sizes[0],