From e37055354b19e3abfe6d609d107dfb357c233f92 Mon Sep 17 00:00:00 2001 From: zhouhao Date: Tue, 14 Jan 2025 12:15:07 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E5=9B=BD?= =?UTF-8?q?=E9=99=85=E5=8C=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/hswebframework/web/i18n/I18nSupportUtils.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hsweb-core/src/main/java/org/hswebframework/web/i18n/I18nSupportUtils.java b/hsweb-core/src/main/java/org/hswebframework/web/i18n/I18nSupportUtils.java index 66f710a3b..e5b48f1ae 100644 --- a/hsweb-core/src/main/java/org/hswebframework/web/i18n/I18nSupportUtils.java +++ b/hsweb-core/src/main/java/org/hswebframework/web/i18n/I18nSupportUtils.java @@ -1,5 +1,6 @@ package org.hswebframework.web.i18n; +import org.apache.commons.collections4.MapUtils; import org.springframework.util.StringUtils; import java.util.Collection; @@ -18,8 +19,13 @@ public class I18nSupportUtils { container = new HashMap<>(); } - container.compute(property, - (p, c) -> putI18nMessages(i18nKey, locales, defaultMsg, c)); + container.compute( + property, + (p, c) -> { + Map msg = putI18nMessages(i18nKey, locales, defaultMsg, c); + //为空不存储 + return MapUtils.isEmpty(msg) ? null : msg; + }); return container; }