Spring MVC and ICU ULocale
I am working on adding a Spring MVC module to an existing application. This application uses the ICU library for its internationalization, in particular the ULocale object. I am aware that the Spring MVC library automatically links each request with a java.util.Locale object so that it can be included in a Controller method as an argument. I would like to do the same thing with the ICU ULocale object. Does anyone have any advice on how best to accomplish this?
Here is an example of what I would like to be able to do:
Code:
@RequestMapping("/helloWorld")
public ModelAndView exampleControllerMethod(@RequestParam("id") param, ULocale icuLocale) {
//...
}
The simplest solution I can think of is to write a simple converter that takes the java.util.Locale object that the Spring MVC LocaleResolver creates and pass it into an ICU ULocale object (The ULocale constructor takes a java.util.Locale). If I do this, does anyone know what converter I should use/interface I should implement?
Another possibility is to figure out how to make a similar LocaleResolver structure for the ULocale object. Advice on how to do that would be greatly appreciated. Thanks for your help.