From 6c0f1b50edd16f25a59c878c0ceb43e40481d9cf Mon Sep 17 00:00:00 2001 From: CaptainB Date: Thu, 1 Feb 2024 10:28:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E4=B9=8B=E5=90=8E=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E4=B8=8D=E8=83=BD=E6=AD=A3=E5=B8=B8=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/system/service/NoticeSendService.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/NoticeSendService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/NoticeSendService.java index 28f4f77f26..ae1c14e703 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/NoticeSendService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/NoticeSendService.java @@ -84,13 +84,11 @@ public class NoticeSendService { private static void setLanguage(NoticeModel noticeModel) { String language = (String) noticeModel.getParamMap().get("Language"); - if (StringUtils.isBlank(language)) { - language = "zh_CN"; + Locale locale = Locale.SIMPLIFIED_CHINESE; + if (StringUtils.isNotBlank(language)) { + locale = Locale.forLanguageTag(language); } - if (language.contains("-")) { - language = language.replace("-","_"); - } - LocaleContextHolder.setLocale(Locale.of(language)); + LocaleContextHolder.setLocale(locale); } /** @@ -144,4 +142,5 @@ public class NoticeSendService { LogUtils.error(e.getMessage(), e); } } + }