refactor(消息管理): 增加消息通知语言环境

This commit is contained in:
guoyuqi 2024-02-01 11:57:10 +08:00 committed by 刘瑞斌
parent 579c6e4015
commit 9ce4a23b7b
1 changed files with 4 additions and 2 deletions

View File

@ -85,8 +85,10 @@ public class NoticeSendService {
private static void setLanguage(NoticeModel noticeModel) {
String language = (String) noticeModel.getParamMap().get("Language");
Locale locale = Locale.SIMPLIFIED_CHINESE;
if (StringUtils.isNotBlank(language)) {
locale = Locale.forLanguageTag(language);
if (StringUtils.containsIgnoreCase("US",language)) {
locale = Locale.US;
} else if (StringUtils.containsIgnoreCase("TW",language)){
locale = Locale.TAIWAN;
}
LocaleContextHolder.setLocale(locale);
}