Skip to content

Commit

Permalink
Merge pull request #18486 from Snuffleupagus/AppOptions-replace-locale
Browse files Browse the repository at this point in the history
Replace the GENERIC-only "locale" with "localeProperties" in AppOptions
  • Loading branch information
timvandermeij authored Jul 23, 2024
2 parents 1c65ad3 + 7ebfad6 commit cb73751
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion web/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 4 additions & 6 deletions web/app_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -473,11 +476,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} */
Expand Down
2 changes: 1 addition & 1 deletion web/genericcom.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit cb73751

Please sign in to comment.