geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Hawtin <>
Subject Re: [i18n] Hardcoded message strings
Date Sat, 23 Aug 2003 19:38:44 GMT
Alex Blewitt wrote:
> I think the only way of achieving this would be to have a 
> formatExceptionInLocale(Locale) method which could choose the 
> translation at print time, rather than at construction time.

I guess getLocalizedMessage() should print a message localized for the 
environment it is called on, rather than the environment the exception 
was originally created in. The exception may o fcourse have been 
serialized. Then there's the question as to whether the message should 
be looked up on the constructing and printing machine.

Anyway I've updated my code to, amongst other things, use XSLT 
(Exception.xsl should be applied to exception-list.xml with 
Exceptions.xml being picked up by document()). It should be easy enough 
to create as many versions of the code as you want. Perhaps one per 
package. Perhaps coarser. May want to split out exception subclasses so 
that they are reused between different "Exceptions" factory classes.

  o Significantly simplifies exception (re)throwing code.
  o More obvious when throwing code is doing something unusual.
  o I18n, chaining and logging all under one roof.
  o Adds to complexity of build process.
  o The XSLT is pretty icky (although you don't need to so much as look 
at that to change the supported exceptions or the code template).
  o Who wants i18n of exception messages anyway?

Tom Hawtin

View raw message