Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix: i18n strings not falling back correctly (#4447)

Andrew Bastin88295cc6e496
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 <HoppModule>{
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)