¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import org.springframework.context.MessageSource; |
| | | import org.springframework.context.i18n.LocaleContextHolder; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | |
| | | /** |
| | | * è·åi18nèµæºæä»¶ |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | 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()); |
| | | } |
| | | } |