Style configurator: Log error and discard invalid locale values

This commit is contained in:
Abe Jellinek 2025-10-14 11:43:43 -04:00 • committed by Dan Stillman
parent c76371aeed
commit a4e0eaaba4

View file

@ -107,6 +107,15 @@
}
set value(val) {
try {
// eslint-disable-next-line no-new
new Intl.Locale(val);
}
catch (e) {
Zotero.logError(e);
val = '';
}
this._value = val;
const styleData = this._style ? Zotero.Styles.get(this._style) : null;
this.localeListEl.value = styleData && styleData.locale || this._value;