How do you i18n your drop-downs?
As I'm developing this morning and pulling a drop-down list from the database, it hit me - I'm not internationalizing these drop-down values. Sure, putting them in the database makes it easier for admins to edit the values, but if a user visits the site with a Spanish locale, they're going to get English drop-downs. So how do I fix this?
Is the best solution to put the drop-down choices in Struts' ApplicationResources.properties file so that I can render the values with <bean:message/> or <fmt:message/>? How do you do it in your webapps?
In some cases, I guess it doesn't matter as the values need to be in English. Take for instance, AppFuse's edit user screen (user/pass: mraible/tomcat). The list of roles comes from the database and should always be in English because the form-based authentication depends on having an English role_name value in the user_role.role_name column - since this is the value coded in web.xml.
Posted by Unknown on February 18, 2004 at 06:03 PM MST #
Maybe I should use something like these message resource implementations. I'd rather see a MVC-framework-agnostic way of doing this though...
Posted by Matt Raible on February 18, 2004 at 06:39 PM MST #
Posted by Unknown on February 18, 2004 at 06:52 PM MST #
Posted by Ugo Cei on February 18, 2004 at 08:59 PM MST #
Posted by David Czarnecki on February 18, 2004 at 09:01 PM MST #
Posted by Harold Neiper on February 19, 2004 at 02:17 AM MST #
Otherwise, the 'DropDownListCreator' can query the database and construct a Collection of LabelValueBean accordingly.
At the end, multiple form beans can re-use the same Collection, combine this with OSCache if you really want to avoid reconstructing the Collections.
Posted by Harod Ruthgar on February 19, 2004 at 02:57 AM MST #
Posted by mahmoud on August 04, 2006 at 08:49 PM MDT #