Add orientation description to the pageSize information, displayed in the properties dialog

Since the l10n strings were added in a previous commit, modifying them here shouldn't be a problem since they haven't landed in mozilla-central yet.
This commit is contained in:
Jonas Jenwald 2018-03-20 13:58:55 +01:00
parent f3b74c5028
commit fc0038d609
3 changed files with 19 additions and 9 deletions

View File

@ -92,10 +92,12 @@ document_properties_page_count=Page Count:
document_properties_page_size=Page Size: document_properties_page_size=Page Size:
document_properties_page_size_unit_inches=in document_properties_page_size_unit_inches=in
document_properties_page_size_unit_millimeters=mm document_properties_page_size_unit_millimeters=mm
document_properties_page_size_orientation_portrait=portrait
document_properties_page_size_orientation_landscape=landscape
# LOCALIZATION NOTE (document_properties_page_size_dimension_string): # LOCALIZATION NOTE (document_properties_page_size_dimension_string):
# "{{width}}", "{{height}}", and {{unit}} will be replaced by the size, # "{{width}}", "{{height}}", {{unit}}, and {{orientation}} will be replaced by
# respectively their unit of measurement, of the (current) page. # the size, respectively their unit of measurement and orientation, of the (current) page.
document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}} document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}} ({{orientation}})
document_properties_close=Close document_properties_close=Close
print_progress_message=Preparing document for printing… print_progress_message=Preparing document for printing…

View File

@ -92,10 +92,12 @@ document_properties_page_count=Sidantal:
document_properties_page_size=Sidstorlek: document_properties_page_size=Sidstorlek:
document_properties_page_size_unit_inches=tum document_properties_page_size_unit_inches=tum
document_properties_page_size_unit_millimeters=mm document_properties_page_size_unit_millimeters=mm
document_properties_page_size_orientation_portrait=stående
document_properties_page_size_orientation_landscape=liggande
# LOCALIZATION NOTE (document_properties_page_size_dimension_string): # LOCALIZATION NOTE (document_properties_page_size_dimension_string):
# "{{width}}", "{{height}}", and {{unit}} will be replaced by the size, # "{{width}}", "{{height}}", {{unit}}, and {{orientation}} will be replaced by
# respectively their unit of measurement, of the (current) page. # the size, respectively their unit of measurement and orientation, of the (current) page.
document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}} document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}} ({{orientation}})
document_properties_close=Stäng document_properties_close=Stäng
print_progress_message=Förbereder sidor för utskrift… print_progress_message=Förbereder sidor för utskrift…

View File

@ -14,7 +14,8 @@
*/ */
import { import {
cloneObj, getPageSizeInches, getPDFFileNameFromURL, NullL10n cloneObj, getPageSizeInches, getPDFFileNameFromURL, isPortraitOrientation,
NullL10n
} from './ui_utils'; } from './ui_utils';
import { createPromiseCapability } from 'pdfjs-lib'; import { createPromiseCapability } from 'pdfjs-lib';
@ -266,6 +267,7 @@ class PDFDocumentProperties {
height: pageSizeInches.width, height: pageSizeInches.width,
}; };
} }
const isPortrait = isPortraitOrientation(pageSizeInches);
const sizeInches = { const sizeInches = {
width: Math.round(pageSizeInches.width * 100) / 100, width: Math.round(pageSizeInches.width * 100) / 100,
@ -282,12 +284,16 @@ class PDFDocumentProperties {
this.l10n.get('document_properties_page_size_unit_' + this.l10n.get('document_properties_page_size_unit_' +
(this._isNonMetricLocale ? 'inches' : 'millimeters'), null, (this._isNonMetricLocale ? 'inches' : 'millimeters'), null,
this._isNonMetricLocale ? 'in' : 'mm'), this._isNonMetricLocale ? 'in' : 'mm'),
]).then(([{ width, height, }, unit]) => { this.l10n.get('document_properties_page_size_orientation_' +
(isPortrait ? 'portrait' : 'landscape'), null,
isPortrait ? 'portrait' : 'landscape'),
]).then(([{ width, height, }, unit, orientation]) => {
return this.l10n.get('document_properties_page_size_dimension_string', { return this.l10n.get('document_properties_page_size_dimension_string', {
width: width.toLocaleString(), width: width.toLocaleString(),
height: height.toLocaleString(), height: height.toLocaleString(),
unit, unit,
}, '{{width}} × {{height}} {{unit}}'); orientation,
}, '{{width}} × {{height}} {{unit}} ({{orientation}})');
}); });
} }