Ole: Comment from the peanut gallery: I definitely understand the need for localized exceptions (or the messages in the exceptions, anyway). Although the *user* might see a more polite (and internationalized) message, the sys admin for most of my clients isn't a native english-speaker either, so making them wade through an english message isn't my first choice.
Mike On Tue, 23 Apr 2002 19:40:27 +0200 Ole Bulbuk <[EMAIL PROTECTED]> wrote: > Hi, > > I have noticed that there exists a package org.apache.avalon.excalibur.i18n > that supports internationalization/localization. So I suppose somebody is > using it. The thing I usually need most on the server side is localized > exceptions since they might be shown to the user (e. g. in a message box) on > the client side. And I don't really like to ignore this like Sun and all the > others who just create exceptions with hard coded (english text) strings. > Even M$ doesn't bother a user with english error messages on a german > Windows. And I really don't want to be under the standard of M$. So I really > would like to solve this problem and I suppose the problem is common enough > for the solution to be provided somewhere under the avalon umbrella. > > I usually create an abstract base I18nException/L7dException for this, that > is > really returning a localized message when getLocalizedMessage() is called. > It could/should extend CascadingException and provide something like the > following constructors: > > 1. I18nException(Object hint, Serializable[] params, Throwable cause) > 2. I18nException(Serializable[] params, Throwable cause) > 3. I18nException(Serializable[] params) > 4. I18nException(Object hint, Serializable[] params) > > The hint would help in finding the right format string (added to the FCQN of > the exception) from a excalibur.i18n.Resources. Implementations would > provide static format strings for the getMessage() method or if the > resources aren't found. So there shouldn't be any performance issues when > getLocalizedMessage() isn't used. > > The params are used as the arguments array to MessageFormat.format() and the > cause is of course used for the CascadingException. > > I would be willing to provide such an exception class if desired. > I suppose it would be best to have it in the > org.apache.avalon.excalibur.i18n package since people who don't care about > i18n won't make use of it anyway. > > Otherwise I will put it in a EBP (company) package if you aren't interested. > Getting it out later will be more difficult since people here might think I > stole it from the company. > > Of course it would be nice to be able to configure the logging mechanism to > use the getLocalizedMessage() method. So the system administrator will get > messages he is able to understand (logging the name of the exception, the > hint and the params might be even better if the log file is read via a > special application, so a german administrator is able to administrate a > server located in Japan). > > Regards, > > Ole > > P.S.: Sorry for the eye-catching style but my last message regarding this > subject was ignored? > -- > Ole Bulbuk Tel.: 0331/74759/60 > Ernst Basler + Partner Fax: 0331/74759/90 > Tuchmacherstr. 47 E-Mail: mailto:[EMAIL PROTECTED] > 14482 Potsdam WWW: http://www.ebp.de > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> JGlobal Ltd. http://www.jglobalonline.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>