1) <bean:message> is already smart enough to do what you want, so I don't see the necessity of making bean:write locale sensitive. You get the right text from some place, and if it's the property file, you already have what you need.
2) I think there is an existing feature request in BugZilla to make the html:options and html:optionCollection tags sensitive to locale. I know I'd like this feature, but how to pull it off, I'm not quite sure. I keep thinking that somehow LabelValueBean should have a Locale attribute and then the option tags can be smarter about the process. Or maybe giving the tags a map of collections instead (each collection you'd want to use for labels is stored in a map keyed by language code). Not sure, but this seems to have the most potential. If there was a clean way to do this, I suspect it would be done by now. But the killer for me was this- 3) How do you solve the reverse lookup problem, e.g. How do you display the label that the user previously selected from a dropdown box, but without a dropdown box? You've got to do something with bean:message...which means you've got to go to the properties file anyway to get the correct text for the code your using, right? And If so, what exactly were you gaining by storing everything in a collection again???? Because of #3, I still do this the hard way. I import jsp files with a bunch of <html:option> statements (I'm such a luddite). Heck, I once found myself creating dropdown lists for height and weight (property lines and html option code) using *Excel*. -Joe > -----Original Message----- > From: Colin Kilburn [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 20, 2004 5:15 PM > To: [EMAIL PROTECTED] > Subject: i18n of bean properties/data > > > Hi All, > > I'm not sure if this has been done before as I can't see any > reference > in the archives, but I have a hard time believing I'm the only one. > > I have to support multiple languages in my app. I can > successfully set > my users' locales using the Action.setLocale() method as well as the > jstl equivalent of Config.setAttribute(...). I have an > ApplicationResources file for each language I need to support > (English > and French), and this covers all my form captions and success/error > messages. This was slick and easy. Great. > > Now, most of my forms (and I know I'm not alone here) have > select lists > to choose an item such as country, favorite color, or > whatever. These > fields usually correspond to foreign keys in my database, so > I load the > appropriate lists from the database. Often this data must > be bilingual > too, so in these select boxes, I need to display a different column's > data in the list depending on the user's locale. > > For example: > > Say I have a bean called Color with three properties: id, > name, nameFr > -- corresponding to the default (English) and French versions of the > select option. Depending on the locale, I want to display the > appropriate property (labelProperty) in the options list. What I'd > like to be able to do is say: > > <html:options collection="colorList" property="id" > labelProperty="name"/> > > and have the tag know that based on the locale, if it were > french, that > it should use nameFr as the labelProperty (if such a property exists). > > > I can imagine how I could implement a subclass of the <html:options/> > tag to do this (with a big help from BeanUtils), but I'm wondering if > anyone else has tackled this type of thing before. I can > also forsee > needing an equivalent alternative to a <c:out/> or perhaps > <bean:write/>, that knows to append the locale to the > property name of > the bean specified. > > I hope this makes sense. I'm ready to roll my own here, but > I wanted > to see if anyone else has been here before. Any comments/ideas > appreciated. > > Colin > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]