On Tue, 17 Apr 2001, John Chang wrote:

> 
> Hi there,
> 
> In the ActionError, we can internationalize the first
> parameter: key.  But I am wondering if we can also
> internationlize the other parameters, which are
> replacement values.  For example, I have some
> replacement values which are Strings.  If these
> Strings can be in different languages, my resources
> file can be much simplier.  
> 
> I have checked the struts source code.  It doesn't
> seem to support this requirement.  While if the
> pageContext object can be passed into form bean's
> validate method, or it can be got from request object,
> then this problem can be solved.  Can anyone give me
> some idea?  
> 
> Thanks,

The java.text.MessageFormat class (which is how Struts is doing the
substitution) does not support internationalizing the replacement
parameters directly.  But how about doing this in two steps?

* Look up the internationalized replacement value from
  a MessageResources bundle

* Use the returned String as the replacement value in the
  ultimate message.

> 
> John
> 

Craig

Reply via email to