定义统一Locale获取国际化(I8Z7DA)
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
package com.ruoyi.common.constant;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* 通用常量信息
|
||||
*
|
||||
@ -17,6 +19,11 @@ public class Constants
|
||||
*/
|
||||
public static final String GBK = "GBK";
|
||||
|
||||
/**
|
||||
* 系统语言
|
||||
*/
|
||||
public static final Locale DEFAULT_LOCALE = Locale.SIMPLIFIED_CHINESE;
|
||||
|
||||
/**
|
||||
* http请求
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.ruoyi.common.utils;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
|
||||
/**
|
||||
@ -21,6 +21,6 @@ public class MessageUtils
|
||||
public static String message(String code, Object... args)
|
||||
{
|
||||
MessageSource messageSource = SpringUtils.getBean(MessageSource.class);
|
||||
return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
|
||||
return messageSource.getMessage(code, args, Constants.DEFAULT_LOCALE);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user