Jul 24th, 2007, 06:55 AM
Fun with messages
I'm chasing my tail on this one.
It all starts with the fact that internationalizing spring requires us to have multiple message files for English (US), English(CA), English(GB) even though these are all the same messages.
I looked through the docs and couldn't find anything that Spring would help me out with this. I will probably open a JIRA for future enhancement.
So to keep my app from blowing up when someone else comes in from Canada, I feed it a list of valid locales and have it replicate the ones it can find to others it can't of the same language.
To do all of this, I use getResource on the class loader to find the messages file and make copies of it appropriately. This worked great in my junit test.
Problem is that the custom class loader used by Spring doesn't seem to be finding the messages_en_US.properties file, even though Spring finds it just fine.
I'm not sure what I'm expecting others to help with. Sage advice, perhaps?
Jul 24th, 2007, 11:04 AM
I ended up using getBundleClassLoader on ResourceBundleMessageSource. This gave me the ClassLoader I needed to call getResource on and found my properties files for me.
Jul 25th, 2007, 07:12 AM
I have created Spring JIRA SPR-3711 for this enhancement. If you found this doing a search, please vote for this JIRA at: