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]



Reply via email to