You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sis.apache.org by Martin Desruisseaux <ma...@geomatys.fr> on 2012/10/23 13:05:28 UTC

Proposed policy on Exception locales

Hello all

java.lang.Throwable has two methods for fetching the exception message: 
getMessage() and getLocalizedMessage(). I realize that the later is very 
rarely implemented. However I'm considering to use it for some (not 
necessarily all) exceptions implemented in Apache SIS. The proposed 
policy would be:

  * getMessage() returns the message in the system default locale.
  * getLocalizedMessage() returns the message in the locale of the
    object that produced it.


For example on a server machine configured for the English locale, if an 
AngleFormat object has been created for parsing angles in the French 
locale and if that AngleFormat throw a java.text.ParseException, then 
getMessage() on that exception would return the parsing error message in 
English while getLocalizedMessage() would return the message in French.

In a client-server architecture, the intend is that getMessage() would 
use the locale on the server side, while getLocalizedMessage() would use 
the locale on the client side. This is based on the assumption that the 
above-cited AngleFormat has been created for parsing client's input.

Is there any opinion on that?

     Martin


Re: Proposed policy on Exception locales

Posted by Martin Desruisseaux <ma...@geomatys.fr>.
Le 23/10/12 20:12, Adam Estrada a écrit :
> I like the idea of using the OS local language as there are many many many
> users who are not native English speakers. That being said, its probably
> better to standardize on something and if English is the standard that is
> already being used, I say we stick to that.

I think that English is widely hard-coded in Exception messages more 
because of "developer laziness" than standards. For example the JavaDB 
(a.k.a. Derby) exception messages are localized using the OS local language.

That said, maybe we don't need to ask anyone to localize their exception 
messages. Some exceptions are more likely to be see by users than 
others. For example I think there is no point in localizing 
AssertionError message. On the other hand ParseException messages are 
more likely to be show to user when parsing user input in a GUI text 
field for instance...

     Martin


Re: Proposed policy on Exception locales

Posted by Adam Estrada <es...@gmail.com>.
Martin,

I like the idea of using the OS local language as there are many many many
users who are not native English speakers. That being said, its probably
better to standardize on something and if English is the standard that is
already being used, I say we stick to that.

Adam

On Tue, Oct 23, 2012 at 7:05 AM, Martin Desruisseaux <
martin.desruisseaux@geomatys.fr> wrote:

> Hello all
>
> java.lang.Throwable has two methods for fetching the exception message:
> getMessage() and getLocalizedMessage(). I realize that the later is very
> rarely implemented. However I'm considering to use it for some (not
> necessarily all) exceptions implemented in Apache SIS. The proposed policy
> would be:
>
>  * getMessage() returns the message in the system default locale.
>  * getLocalizedMessage() returns the message in the locale of the
>    object that produced it.
>
>
> For example on a server machine configured for the English locale, if an
> AngleFormat object has been created for parsing angles in the French locale
> and if that AngleFormat throw a java.text.ParseException, then getMessage()
> on that exception would return the parsing error message in English while
> getLocalizedMessage() would return the message in French.
>
> In a client-server architecture, the intend is that getMessage() would use
> the locale on the server side, while getLocalizedMessage() would use the
> locale on the client side. This is based on the assumption that the
> above-cited AngleFormat has been created for parsing client's input.
>
> Is there any opinion on that?
>
>     Martin
>
>

Re: Proposed policy on Exception locales

Posted by "Mattmann, Chris A (388J)" <ch...@jpl.nasa.gov>.
+1 this sounds good to me, Martin.

Cheers,
Chris

On Oct 23, 2012, at 4:05 AM, Martin Desruisseaux wrote:

> Hello all
> 
> java.lang.Throwable has two methods for fetching the exception message: getMessage() and getLocalizedMessage(). I realize that the later is very rarely implemented. However I'm considering to use it for some (not necessarily all) exceptions implemented in Apache SIS. The proposed policy would be:
> 
> * getMessage() returns the message in the system default locale.
> * getLocalizedMessage() returns the message in the locale of the
>   object that produced it.
> 
> 
> For example on a server machine configured for the English locale, if an AngleFormat object has been created for parsing angles in the French locale and if that AngleFormat throw a java.text.ParseException, then getMessage() on that exception would return the parsing error message in English while getLocalizedMessage() would return the message in French.
> 
> In a client-server architecture, the intend is that getMessage() would use the locale on the server side, while getLocalizedMessage() would use the locale on the client side. This is based on the assumption that the above-cited AngleFormat has been created for parsing client's input.
> 
> Is there any opinion on that?
> 
>    Martin
>