From 7b707a3c2b06386b4ce43e6dfef1d62fb38eab87 Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Sat, 14 Sep 2024 14:58:21 +0700 Subject: [PATCH] fix(i18n): `Function is not a constructor` crash --- src/core/i18n/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/i18n/index.ts b/src/core/i18n/index.ts index 0cff2575..28092ea9 100644 --- a/src/core/i18n/index.ts +++ b/src/core/i18n/index.ts @@ -5,7 +5,7 @@ import type { PrimitiveType } from "intl-messageformat"; import langDefault from "./default.json"; -const IntlMessageFormat = findByNameLazy("MessageFormat") as typeof import("intl-messageformat").default; +const IntlMessageFormat = findByNameLazy("MessageFormat") as typeof import("intl-messageformat"); type I18nKey = keyof typeof langDefault; @@ -68,5 +68,5 @@ type FormatStringRet = T extends PrimitiveType ? string : string | T | (strin export function formatString(key: I18nKey, val: Record): FormatStringRet { const str = Strings[key]; // @ts-ignore - return new IntlMessageFormat(str).format(val); + return new IntlMessageFormat.IntlMessageFormat(str).format(val); }