Today I got a bug report that e-mail subject appeared in Dutch while they should have been send in English. The first thing I check of course was whether the correct locale was used. It was.
Here is the situation:
- Spring message source
- 2 files: email-subjects.properties and email-subjects_nl.properties
- requested locale: en_US
After a bit of debugging I noticed that Spring looks for the following files (in order):
- email-subjects_en_us.properties
- email-subjects_en.properties
- email-subjects_nl_NL.properties
- email-subjects_nl.properties
- email-subjects.properties
WTF?! It also looks for the default locale! Thank you Spring! This is really the first time you disappoint me (in 4 years, not bad). But of course I should have looked further, when will Spring ever let you down?
The solution? Well luckily the authors of the code realized this is not always what you want. An easy
setFallbackToSystemLocale(false) overrides this funny behavior. I added
<property name="fallbackToSystemLocale" value="false" /> to my config file and it all worked. Hurray for Spring!
Update 2008-08-04: adapted the article to the real solution.
Just use a symbolic link..
ReplyDeleteln -s target link_name
Daan, how do I check this in into CVS?
ReplyDelete