You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Dan,
your example MVC app on internationalization is not working with Spring Boot 2.1.3, as this version resolves the locale from the browser's accept-language header, which will always override the settings from application.properties.
I had to provide a minimal WebMvcConfigurer to allow changing the locale via a request parameter to get it to work.
`/** */ @configuration
public class WebConfig implements WebMvcConfigurer {
@Bean
public LocaleResolver localeResolver() {
SessionLocaleResolver localeResolver = new SessionLocaleResolver();
return localeResolver;
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
localeChangeInterceptor.setParamName("lang");
registry.addInterceptor(localeChangeInterceptor);
WebMvcConfigurer.super.addInterceptors(registry);
}
}`
The text was updated successfully, but these errors were encountered:
Hi Dan,
your example MVC app on internationalization is not working with Spring Boot 2.1.3, as this version resolves the locale from the browser's accept-language header, which will always override the settings from application.properties.
I had to provide a minimal WebMvcConfigurer to allow changing the locale via a request parameter to get it to work.
`/** */
@configuration
public class WebConfig implements WebMvcConfigurer {
}`
The text was updated successfully, but these errors were encountered: