From 88295cc6e496e07e564d391daebc2d0c53c596b8 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Thu, 17 Oct 2024 16:27:17 +0530 Subject: [PATCH] fix: i18n strings not falling back correctly (#4447) --- packages/hoppscotch-common/src/modules/i18n.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/hoppscotch-common/src/modules/i18n.ts b/packages/hoppscotch-common/src/modules/i18n.ts index a65152732..3bdde0fb5 100644 --- a/packages/hoppscotch-common/src/modules/i18n.ts +++ b/packages/hoppscotch-common/src/modules/i18n.ts @@ -11,6 +11,8 @@ import { throwError } from "~/helpers/functional/error" import { PersistenceService } from "~/services/persistence" import { getService } from "./dioc" +import FALLBACK_LANG_MESSAGES from "../../locales/en.json" + /* In context of this file, we have 2 main kinds of things. 1. Locale -> A locale is termed as the i18n entries present in the /locales folder @@ -144,6 +146,12 @@ export default { i18nInstance = i18n + // Load in fallback lang messages + i18nInstance.global.setLocaleMessage( + FALLBACK_LANG_CODE, + FALLBACK_LANG_MESSAGES + ) + // TODO: Global loading state to hide the resolved lang loading const currentLocale = resolveCurrentLocale() changeAppLanguage(currentLocale)