This commit is contained in:
Hsy
2025-07-28 10:10:49 +08:00
commit 2e51dd9382
309 changed files with 39735 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
package com.devttl.common.utils;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import com.devttl.common.utils.spring.SpringUtils;
/**
* 获取i18n资源文件
*
* @author devttl
*/
public class MessageUtils
{
/**
* 根据消息键和参数 获取消息 委托给spring messageSource
*
* @param code 消息键
* @param args 参数
* @return 获取国际化翻译值
*/
public static String message(String code, Object... args)
{
MessageSource messageSource = SpringUtils.getBean(MessageSource.class);
return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
}
}