定义统一Locale获取国际化(I8Z7DA)

This commit is contained in:
RuoYi
2024-03-13 11:38:35 +08:00
parent fd37e8b4a7
commit f6ce55be47
3 changed files with 11 additions and 4 deletions

View File

@ -1,6 +1,5 @@
package com.ruoyi.framework.config;
import java.util.Locale;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.LocaleResolver;
@ -8,6 +7,7 @@ import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;
import com.ruoyi.common.constant.Constants;
/**
* 资源文件配置加载
@ -22,7 +22,7 @@ public class I18nConfig implements WebMvcConfigurer
{
SessionLocaleResolver slr = new SessionLocaleResolver();
// 默认语言
slr.setDefaultLocale(Locale.SIMPLIFIED_CHINESE);
slr.setDefaultLocale(Constants.DEFAULT_LOCALE);
return slr;
}