From 38215be3bd82693a166008aad5fc948a0dd0212d Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Mon, 3 Jul 2023 11:39:00 +0530 Subject: [PATCH] refactor: provide global i18n function through the module --- 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 9366b0be6..b5d171e88 100644 --- a/packages/hoppscotch-common/src/modules/i18n.ts +++ b/packages/hoppscotch-common/src/modules/i18n.ts @@ -115,6 +115,14 @@ export const changeAppLanguage = async (locale: string) => { setLocalConfig("locale", locale) } +/** + * Returns the i18n instance + */ +export function getI18n() { + // @ts-expect-error Something weird with the i18n errors + return i18nInstance!.global.t +} + export default { onVueAppInit(app) { const i18n = createI18n({