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 () { onLocaleChange: function () {
var requestedLocale = Services.locale.getRequestedLocale(); var requestedLocale = Services.locale.getRequestedLocale();
var menu = document.getElementById('locale-menu'); var menu = document.getElementById('locale-menu');
if (menu.value == 'automatic') { if (menu.value == 'automatic') {
// 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
&& requestedLocale == Zotero.locale
&& menu.label != this._getAutomaticLocaleMenuLabel();
Services.locale.setRequestedLocales(null); Services.locale.setRequestedLocales(null);
} }
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 = requestedLocale != menu.value
Services.locale.setRequestedLocales([menu.value]); Services.locale.setRequestedLocales([menu.value]);
} }

View file

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