struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bOOyah <>
Subject Re: Translating i18n keys in Struts?
Date Mon, 12 Apr 2004 16:00:56 GMT
Joe Hertz wrote:

> You just need property files defining the various i18n strings.

Sorry Joe - I obviously didn't explain myself adequately.

I already have property files containing i18n keys + strings.  Like this:
     menu.item.about="About This Application"

And in my Struts Action I'm sending a collection of menu entries to the 
JSP (which uses 'html:select' and 'html:optionsCollection' tags to 
render the menu):

     MenuItem item = new MenuItem();;

All this does is render a HTML select list containing the "menu.item..." 
strings rather than the locale-specific strings.

So, in my Action class I have added a helper method that iterates 
through the  menuCollection, replaces the i18n keys with their actual 
locale-specific strings and places THAT collection in the form as the 
menu.  This translation happens every time the Execute() method is called.

But is there some i18n 'magic component' in Struts that would do that 
for me?  Or do I have to rewrite (or reuse) my helper method in every 
Action for now on?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message