From f5566463a2fa13705f764ef04044196b218d2743 Mon Sep 17 00:00:00 2001 From: Danny Gleckler Date: Mon, 10 Mar 2025 16:37:56 -0400 Subject: [PATCH] Fail gracefully --- lib/common.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/common.js b/lib/common.js index a8e492e..978cde9 100644 --- a/lib/common.js +++ b/lib/common.js @@ -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); });