Fix changing locale via keyboard on Windows

(And maybe Linux)

https://forums.zotero.org/discussion/94866/beta-6-0-no-shortcut-key-could-be-applied-in-language-of-advanced-setting
This commit is contained in:
Dan Stillman 2022-03-05 00:47:59 -05:00
parent 3c42103848
commit f6bd7269ae
2 changed files with 7 additions and 4 deletions

View file

@ -629,15 +629,18 @@ Zotero_Preferences.Advanced = {
onLocaleChange: function () {
var requestedLocale = Services.locale.getRequestedLocale();
var menu = document.getElementById('locale-menu');
if (menu.value == 'automatic') {
// 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();
var changed = requestedLocale
&& requestedLocale == Zotero.locale
&& menu.label != this._getAutomaticLocaleMenuLabel();
Services.locale.setRequestedLocales(null);
}
else {
// Changed if moving to a locale other than the current one
var changed = Zotero.locale != menu.value
var changed = requestedLocale != menu.value
Services.locale.setRequestedLocales([menu.value]);
}

View file

@ -85,8 +85,8 @@
<hbox align="center">
<label value="&zotero.bibliography.locale.label;"/>
<menulist id="locale-menu"
oncommand="Zotero_Preferences.Advanced.onLocaleChange()">
<menupopup/>
onblur="if (!Zotero.isMac) Zotero_Preferences.Advanced.onLocaleChange()">
<menupopup onpopuphidden="Zotero_Preferences.Advanced.onLocaleChange()"/>
</menulist>
</hbox>
</groupbox>