I'm using a custom implemented ResourceBundleMessageSource
:
public class CustomResourceBundleMessageSource
extends org.springframework.context.support.ResourceBundleMessageSource { //... }
Shortly, it's looking for message codes into resource bundles according to current locale.
public final String getMessage(String code) {
return getMessage(code, null, null, getCurrentLocale());
}
public Locale getCurrentLocale() {
Locale locale = ThreadLocalHolder.get(LOCALE_PROPERTY_NAME, Locale.class);
if (locale == null) {
locale = (defaultLocale==null)?Locale.getDefault():defaultLocale;
}
return locale;
}
As you can see it's picking current locale from a ThreadLocalHolder
class.
So, I'd like to resolve Accept-Language
request header and set this value on this ThreadLocalHolder
.
Any ideas?