Pre Merge pull request !483 from coderWu/master

This commit is contained in:
coderWu 2024-03-11 03:16:20 +00:00 committed by Gitee
commit 48659a79a5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,7 @@
package com.ruoyi.common.constant;
import java.util.Locale;
/**
* 通用常量信息
*
@ -57,6 +59,11 @@ public class Constants
*/
public static final String LOGIN_FAIL = "Error";
/**
* 系统统一Locale
*/
public static final Locale SYS_LOCALE = Locale.SIMPLIFIED_CHINESE;
/**
* 系统用户授权缓存
*/

View File

@ -1,7 +1,7 @@
package com.ruoyi.common.utils;
import com.ruoyi.common.constant.Constants;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
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.SYS_LOCALE);
}
}

View File

@ -1,6 +1,6 @@
package com.ruoyi.framework.config;
import java.util.Locale;
import com.ruoyi.common.constant.Constants;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.LocaleResolver;
@ -22,7 +22,7 @@ public class I18nConfig implements WebMvcConfigurer
{
SessionLocaleResolver slr = new SessionLocaleResolver();
// 默认语言
slr.setDefaultLocale(Locale.SIMPLIFIED_CHINESE);
slr.setDefaultLocale(Constants.SYS_LOCALE);
return slr;
}