Skip to content

Commit

Permalink
fix(i18n): Function is not a constructor crash
Browse files Browse the repository at this point in the history
  • Loading branch information
PalmDevs committed Sep 14, 2024
1 parent ed9dc44 commit 7b707a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -68,5 +68,5 @@ type FormatStringRet<T> = T extends PrimitiveType ? string : string | T | (strin
export function formatString<T = void>(key: I18nKey, val: Record<string, T>): FormatStringRet<T> {
const str = Strings[key];
// @ts-ignore
return new IntlMessageFormat(str).format(val);
return new IntlMessageFormat.IntlMessageFormat(str).format(val);
}

0 comments on commit 7b707a3

Please sign in to comment.