Wednesday February 18, 2004
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 in Java
at Feb 18 2004, 10:37:10 AM MST
8 Comments
Search This Site
Recent Entries
- Wine Tasting in Napa Valley
- How to build a Shot-Ski
- Bus Project Update
- Farewell to the 2011-2012 Ski Season
- Cruising around the Western Caribbean
- Spring Break!
- A Spectacular Trip to Stockholm and Madrid
- Comparing Web Frameworks and HTML5 with Play Scala at Jfokus 2012
- Play Framework 2.0 with Peter Hilton at Jfokus
- Secure JSON Services with Play Scala and SecureSocial
Posted by Unknown on February 18, 2004 at 12: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 12:39 PM MST #
Posted by Unknown on February 18, 2004 at 12:52 PM MST #
Posted by Ugo Cei on February 18, 2004 at 02:59 PM MST #
Posted by David Czarnecki on February 18, 2004 at 03:01 PM MST #
Posted by Harold Neiper on February 18, 2004 at 08:17 PM 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 18, 2004 at 08:57 PM MST #
Posted by mahmoud on August 04, 2006 at 02:49 PM MDT #