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
{{ message }}
Repository navigation
StringToLocaleConverter should allow BCP 47 values [SPR-16188] #20736
I'm using Spring Boot to setup locale in spring mvc.
I'm trying to use BCP 47 for spring.mvc.locale value, but I end up with a
Property: spring.mvc.locale
Value: en-US
Reason: Failed to convert property value of type 'java.lang.String' to required type 'java.util.Locale' for property 'locale'; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [java.util.Locale]
StringToLocaleConverter (relies on StringUtils.parseLocaleString) relies on _ delimiters, which is not BCP 47.
Could StringToLocaleConverter be improved to handle BCP 47 (or otherwise try both formats ?)
Good point! StringToLocaleConverter leniently supports both variants now, through a new StringUtils.parseLocale variant which adapts to both BCP 47 and the traditional Locale.toString() format.
Activity
spring-projects-issues commentedon Jan 25, 2018
Juergen Hoeller commented
Good point!
StringToLocaleConverterleniently supports both variants now, through a newStringUtils.parseLocalevariant which adapts to both BCP 47 and the traditionalLocale.toString()format.spring-projects-issues commentedon Jan 25, 2018
adrian commented
Great ! Thanks very much Juergen