From 91faa73b19df90cfd70250a3a67c4fa71864cd13 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 24 Mar 2022 07:03:23 -0400 Subject: [PATCH] Don't throw from getString() for missing strings in non-English locales Just show the key We still merge strings before pushing betas, but this means it won't crash for source builds, or if we forget. Not sure why we didn't do this 15 years ago. --- chrome/content/zotero/xpcom/intl.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/intl.js b/chrome/content/zotero/xpcom/intl.js index 1f0cb03584..8b5fe0f98c 100644 --- a/chrome/content/zotero/xpcom/intl.js +++ b/chrome/content/zotero/xpcom/intl.js @@ -128,7 +128,13 @@ Zotero.Intl = new function () { else if (e.name != 'NS_ERROR_FAILURE') { Zotero.logError(e); } - throw new Error('Localized string not available for ' + name); + let msg = 'Localized string not available for ' + name; + if (Zotero.locale == 'en-US') { + throw new Error(msg); + } + // In non-English locales, just return key if string is unavailable + Zotero.debug(msg, 1); + return name; } return l10n; };