1616475fa1acbac1037d980cc099b4fc7d208c64.svn-base 672 B

12345678910111213141516171819202122232425
  1. package cn.com.goldenwater.dcproj.utils;
  2. import org.springframework.context.MessageSource;
  3. import org.springframework.context.i18n.LocaleContextHolder;
  4. /**
  5. * 获取i18n资源文件
  6. *
  7. * @author ruoyi
  8. */
  9. public class MessageUtils
  10. {
  11. /**
  12. * 根据消息键和参数 获取消息 委托给spring messageSource
  13. *
  14. * @param code 消息键
  15. * @param args 参数
  16. * @return 获取国际化翻译值
  17. */
  18. public static String message(String code, Object... args)
  19. {
  20. MessageSource messageSource = SpringUtils.getBean(MessageSource.class);
  21. return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
  22. }
  23. }