From d96fe03fa28037adf73574a735bc0b1952cf7293 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 27 Oct 2019 03:38:08 -0400 Subject: [PATCH] Restart after migrating legacy locale prefs DTDs are loaded based on the initial state of `intl.locale.requested`, so if `intl.locale.matchOS` was false, we need to restart after migrating that to keep part of the UI from being in the wrong locale. (Before zotero/zotero-standalone-build@ced8a0fa63, it would've been English. After it would probably be the OS locale.) https://forums.zotero.org/discussion/79673/zotero-5-0-77-beta-has-no-localization-anymore --- chrome/content/zotero/xpcom/intl.js | 6 ++++++ chrome/content/zotero/xpcom/zotero.js | 1 + 2 files changed, 7 insertions(+) diff --git a/chrome/content/zotero/xpcom/intl.js b/chrome/content/zotero/xpcom/intl.js index cfe75f88fa..537618f1fa 100644 --- a/chrome/content/zotero/xpcom/intl.js +++ b/chrome/content/zotero/xpcom/intl.js @@ -35,9 +35,11 @@ Zotero.Intl = new function () { var prevLocale = Zotero.Prefs.get('general.useragent.locale', true); if (prevMatchOS !== undefined || prevLocale !== undefined) { + let restart = false; if (prevMatchOS === false && prevLocale) { try { Services.locale.setRequestedLocales([prevLocale]); + restart = true; } catch (e) { // Don't panic if the value is not a valid locale code @@ -45,6 +47,10 @@ Zotero.Intl = new function () { } Zotero.Prefs.clear('intl.locale.matchOS', true); Zotero.Prefs.clear('general.useragent.locale', true); + if (restart) { + Zotero.Utilities.Internal.quitZotero(true); + return; + } } Components.utils.import("resource://gre/modules/PluralForm.jsm"); diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 67d6b34d70..db46d6151b 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -240,6 +240,7 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js"); Zotero.browser = "g"; Zotero.Intl.init(); + if (this.restarting) return; yield Zotero.Prefs.init(); Zotero.Debug.init(options && options.forceDebugLog);