RuoYi/ruoyi-common/src/main/java/com/ruoyi/common/utils/MessageUtils.java

27 lines
739 B
Java
Raw Normal View History

package com.ruoyi.common.utils;
2018-07-09 00:44:52 +00:00
import org.springframework.context.MessageSource;
2019-04-24 06:42:12 +00:00
import org.springframework.context.i18n.LocaleContextHolder;
2019-01-24 13:56:45 +00:00
import com.ruoyi.common.utils.spring.SpringUtils;
2018-07-09 00:44:52 +00:00
/**
* i18n
*
* @author ruoyi
*/
public class MessageUtils
{
/**
* spring messageSource
*
* @param code
* @param args
2019-04-24 06:42:12 +00:00
* @return
2018-07-09 00:44:52 +00:00
*/
public static String message(String code, Object... args)
{
MessageSource messageSource = SpringUtils.getBean(MessageSource.class);
2019-04-24 06:42:12 +00:00
return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
2018-07-09 00:44:52 +00:00
}
}