1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 14:48:08 +02:00

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_unit_inches=in
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):
# "{{width}}", "{{height}}", and {{unit}} will be replaced by the size,
# respectively their unit of measurement, of the (current) page.
document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}}
# "{{width}}", "{{height}}", {{unit}}, and {{orientation}} will be replaced by
# the size, respectively their unit of measurement and orientation, of the (current) page.
document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}} ({{orientation}})
document_properties_close=Close
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_unit_inches=tum
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):
# "{{width}}", "{{height}}", and {{unit}} will be replaced by the size,
# respectively their unit of measurement, of the (current) page.
document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}}
# "{{width}}", "{{height}}", {{unit}}, and {{orientation}} will be replaced by
# the size, respectively their unit of measurement and orientation, of the (current) page.
document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}} ({{orientation}})
document_properties_close=Stäng
print_progress_message=Förbereder sidor för utskrift…

View file

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