1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Replace the GENERIC-only "locale" with "localeProperties" in AppOptions

Since "localeProperties" is needed in Firefox, let's remove a tiny bit of option duplication by using it in the GENERIC builds as well.
For convenience, the old debug-only "locale" hash-parameter is kept intact.
This commit is contained in:
Jonas Jenwald 2024-07-23 09:43:12 +02:00
parent 5184a38e3d
commit 7ebfad6d92
3 changed files with 6 additions and 8 deletions

View file

@ -336,7 +336,7 @@ const PDFViewerApplication = {
(typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) &&
params.has("locale")
) {
AppOptions.set("locale", params.get("locale"));
AppOptions.set("localeProperties", { lang: params.get("locale") });
}
// Set some specific preferences for tests.

View file

@ -90,7 +90,10 @@ const defaultOptions = {
},
localeProperties: {
/** @type {Object} */
value: null,
value:
typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")
? { lang: navigator.language || "en-US" }
: null,
kind: OptionKind.BROWSER,
},
nimbusDataStr: {
@ -468,11 +471,6 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
value: typeof PDFJSDev !== "undefined" && PDFJSDev.test("TESTING"),
kind: OptionKind.VIEWER,
};
defaultOptions.locale = {
/** @type {string} */
value: navigator.language || "en-US",
kind: OptionKind.VIEWER,
};
} else if (PDFJSDev.test("CHROME")) {
defaultOptions.disableTelemetry = {
/** @type {boolean} */

View file

@ -39,7 +39,7 @@ class Preferences extends BasePreferences {
class ExternalServices extends BaseExternalServices {
async createL10n() {
return new GenericL10n(AppOptions.get("locale"));
return new GenericL10n(AppOptions.get("localeProperties")?.lang);
}
createScripting() {