From 7aa6c1d1a37409230dd4909ef8a87cbc401cc8a3 Mon Sep 17 00:00:00 2001 From: Quincy Morgan <2046746+quincylvania@users.noreply.github.com> Date: Tue, 15 Sep 2020 18:27:26 -0400 Subject: [PATCH] Fix infinite recursion error for en-US --- modules/core/localizer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/core/localizer.js b/modules/core/localizer.js index 494a27d8a..b23699824 100644 --- a/modules/core/localizer.js +++ b/modules/core/localizer.js @@ -293,10 +293,10 @@ export function coreLocalizer() { // no localized string found... // attempt to fallback to a lower-priority langauge - let fallbackIndex = _localeCodes.indexOf(locale) + 1; - if (fallbackIndex < _localeCodes.length) { + let index = _localeCodes.indexOf(locale); + if (index >= 0 && index < _localeCodes.length - 1) { // eventually this will be 'en' or another locale with 100% coverage - let fallback = _localeCodes[fallbackIndex]; + let fallback = _localeCodes[index + 1]; return localizer.t(stringId, replacements, fallback); }