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;
|
var autoLocaleName, currentValue;
|
||||||
|
|
||||||
// If matching OS, get the name of the current locale
|
// 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();
|
autoLocaleName = this._getAutomaticLocaleMenuLabel();
|
||||||
currentValue = 'automatic';
|
currentValue = 'automatic';
|
||||||
}
|
}
|
||||||
|
@ -504,14 +504,12 @@ Zotero_Preferences.Advanced = {
|
||||||
// Changed if not already set to automatic (unless we have the automatic locale name,
|
// 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)
|
// meaning we just switched away to the same manual locale and back to automatic)
|
||||||
var changed = requestedLocale && menu.label != this._getAutomaticLocaleMenuLabel();
|
var changed = requestedLocale && menu.label != this._getAutomaticLocaleMenuLabel();
|
||||||
Services.locale.setRequestedLocales([]);
|
Services.locale.setRequestedLocales(null);
|
||||||
Zotero.Prefs.clear('intl.regional_prefs.use_os_locales', true);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Changed if moving to a locale other than the current one
|
// Changed if moving to a locale other than the current one
|
||||||
var changed = Zotero.locale != menu.value
|
var changed = Zotero.locale != menu.value
|
||||||
Services.locale.setRequestedLocales([menu.value]);
|
Services.locale.setRequestedLocales([menu.value]);
|
||||||
Zotero.Prefs.set('intl.regional_prefs.use_os_locales', false, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!changed) {
|
if (!changed) {
|
||||||
|
|
|
@ -35,13 +35,9 @@ Zotero.Intl = new function () {
|
||||||
var prevLocale = Zotero.Prefs.get('general.useragent.locale', true);
|
var prevLocale = Zotero.Prefs.get('general.useragent.locale', true);
|
||||||
|
|
||||||
if (prevMatchOS !== undefined || prevLocale !== undefined) {
|
if (prevMatchOS !== undefined || prevLocale !== undefined) {
|
||||||
if (prevMatchOS) {
|
if (prevMatchOS === false && prevLocale) {
|
||||||
Services.locale.setRequestedLocales([]);
|
|
||||||
}
|
|
||||||
else if (prevLocale) {
|
|
||||||
try {
|
try {
|
||||||
Services.locale.setRequestedLocales([prevLocale]);
|
Services.locale.setRequestedLocales([prevLocale]);
|
||||||
Zotero.Prefs.set('intl.regional_prefs.use_os_locales', false, true);
|
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
// Don't panic if the value is not a valid locale code
|
// Don't panic if the value is not a valid locale code
|
||||||
|
|
Loading…
Add table
Reference in a new issue