From f77dcf16523e5f3e0cf45b30c687a627adf3b292 Mon Sep 17 00:00:00 2001 From: liujuping Date: Mon, 25 Sep 2023 18:09:57 +0800 Subject: [PATCH] feat: suport more locale config --- packages/react-simulator-renderer/src/locale/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-simulator-renderer/src/locale/index.ts b/packages/react-simulator-renderer/src/locale/index.ts index e4b39a347..5f4ef0150 100644 --- a/packages/react-simulator-renderer/src/locale/index.ts +++ b/packages/react-simulator-renderer/src/locale/index.ts @@ -9,10 +9,10 @@ const instance: Record> = { export function createIntl(locale: string = 'zh-CN') { const intl = (id: string) => { - return instance[locale][id]; + return instance[locale]?.[id] || id; }; - const intlNode = (id: string) => createElement('span', instance[locale][id]); + const intlNode = (id: string) => createElement('span', instance[locale]?.[id] || id); return { intl,