fix: 尝试修复发布之后国际化消息不能正常显示的问题

This commit is contained in:
CaptainB 2024-02-01 10:28:47 +08:00 committed by 刘瑞斌
parent db5182f37d
commit 6c0f1b50ed
1 changed files with 5 additions and 6 deletions

View File

@ -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);
}
}
}