More locale detection fixes for Firefox 60
`intl.regional_prefs.use_os_locales` isn't actually equivalent to `intl.locale.matchOS` -- an empty string for `intl.locale.requested` is, and that's set by calling `setRequestedLocales(null)`. Mozilla documentation: https://firefox-source-docs.mozilla.org/intl/locale.html
This commit is contained in:
parent
7ebbc7a0ab
commit
1a66f5e518
2 changed files with 3 additions and 9 deletions
|
@ -473,7 +473,7 @@ Zotero_Preferences.Advanced = {
|
|||
var autoLocaleName, currentValue;
|
||||
|
||||
// If matching OS, get the name of the current locale
|
||||
if (Zotero.Prefs.get('intl.regional_prefs.use_os_locales', true)) {
|
||||
if (Zotero.Prefs.get('intl.locale.requested', true) === '') {
|
||||
autoLocaleName = this._getAutomaticLocaleMenuLabel();
|
||||
currentValue = 'automatic';
|
||||
}
|
||||
|
@ -504,14 +504,12 @@ Zotero_Preferences.Advanced = {
|
|||
// Changed if not already set to automatic (unless we have the automatic locale name,
|
||||
// meaning we just switched away to the same manual locale and back to automatic)
|
||||
var changed = requestedLocale && menu.label != this._getAutomaticLocaleMenuLabel();
|
||||
Services.locale.setRequestedLocales([]);
|
||||
Zotero.Prefs.clear('intl.regional_prefs.use_os_locales', true);
|
||||
Services.locale.setRequestedLocales(null);
|
||||
}
|
||||
else {
|
||||
// Changed if moving to a locale other than the current one
|
||||
var changed = Zotero.locale != menu.value
|
||||
Services.locale.setRequestedLocales([menu.value]);
|
||||
Zotero.Prefs.set('intl.regional_prefs.use_os_locales', false, true);
|
||||
}
|
||||
|
||||
if (!changed) {
|
||||
|
|
|
@ -35,13 +35,9 @@ Zotero.Intl = new function () {
|
|||
var prevLocale = Zotero.Prefs.get('general.useragent.locale', true);
|
||||
|
||||
if (prevMatchOS !== undefined || prevLocale !== undefined) {
|
||||
if (prevMatchOS) {
|
||||
Services.locale.setRequestedLocales([]);
|
||||
}
|
||||
else if (prevLocale) {
|
||||
if (prevMatchOS === false && prevLocale) {
|
||||
try {
|
||||
Services.locale.setRequestedLocales([prevLocale]);
|
||||
Zotero.Prefs.set('intl.regional_prefs.use_os_locales', false, true);
|
||||
}
|
||||
catch (e) {
|
||||
// Don't panic if the value is not a valid locale code
|
||||
|
|
Loading…
Reference in a new issue