Skip to content

Commit

Permalink
Fail gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
bearfriend committed Mar 10, 2025
1 parent d4b406d commit f556646
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,12 @@ const localeRegEx = /[^a-zA-Z0-9-]/g;

function updateLocalNames() {
const possibleLocales = [documentLocaleSettings.language, navigator.language, defaultLocale].filter(l => l && !localeRegEx.test(l));
const localName = new Intl.DisplayNames(possibleLocales, { type: 'language' });
let localName;
try {
localName = new Intl.DisplayNames(possibleLocales, { type: 'language' });
} catch {
return;
}
supportedLocalesDetails.forEach(l => {
l.localName = localName.of(l.overrideCode || l.code);
});
Expand Down

0 comments on commit f556646

Please sign in to comment.