I want to first localize the user's locale by detecting a cookie, and if not, then the accept-language header. Spring seems to want to accept only one LocaleResolver
.
Interestingly, Spring docs for CookieLocaleResolver
state
An implementation of LocaleResolver that uses a cookie sent to the user in the case of a user preference, deviating from the default value of the locale or locale of the request-header request.
But actually it is not. testing shows that this does not work, and a quick look at the source shows that it gets the default value if there is no cookie.
Is the only solution for writing my own implementation of LocaleResolver
?
Qwerky
source share