diff --git a/web/app.js b/web/app.js index 8261040c0..45cd34cec 100644 --- a/web/app.js +++ b/web/app.js @@ -229,7 +229,11 @@ const PDFViewerApplication = { * @private */ async _readPreferences() { - if (AppOptions.get("disablePreferences") === true) { + if ( + (typeof PDFJSDev === "undefined" || + PDFJSDev.test("!PRODUCTION || GENERIC")) && + AppOptions.get("disablePreferences") + ) { // Give custom implementations of the default viewer a simpler way to // opt-out of having the `Preferences` override existing `AppOptions`. return; @@ -328,9 +332,11 @@ const PDFViewerApplication = { * @private */ async _initializeL10n() { - this.l10n = this.externalServices.createL10n({ - locale: AppOptions.get("locale"), - }); + this.l10n = this.externalServices.createL10n( + typeof PDFJSDev === "undefined" || PDFJSDev.test("!PRODUCTION || GENERIC") + ? { locale: AppOptions.get("locale") } + : null + ); const dir = await this.l10n.getDirection(); document.getElementsByTagName("html")[0].dir = dir; }, diff --git a/web/app_options.js b/web/app_options.js index 66c478739..f3ac76d8a 100644 --- a/web/app_options.js +++ b/web/app_options.js @@ -53,14 +53,14 @@ const defaultOptions = { value: false, kind: OptionKind.VIEWER + OptionKind.PREFERENCE, }, + /** + * The `disablePreferences` is, conditionally, defined below. + */ enablePermissions: { /** @type {boolean} */ value: false, kind: OptionKind.VIEWER + OptionKind.PREFERENCE, }, - /** - * The `disablePreferences` is, conditionally, defined below. - */ enablePrintAutoRotate: { /** @type {boolean} */ value: false, @@ -110,9 +110,11 @@ const defaultOptions = { value: false, kind: OptionKind.VIEWER + OptionKind.PREFERENCE, }, - /** - * The `printResolution` is, conditionally, defined below. - */ + printResolution: { + /** @type {number} */ + value: 150, + kind: OptionKind.VIEWER, + }, renderer: { /** @type {string} */ value: "canvas", @@ -252,11 +254,6 @@ if ( value: typeof navigator !== "undefined" ? navigator.language : "en-US", kind: OptionKind.VIEWER, }; - defaultOptions.printResolution = { - /** @type {number} */ - value: 150, - kind: OptionKind.VIEWER, - }; } const userOptions = Object.create(null);