• Post Reply Bookmark Topic Watch Topic
  • New Topic

getLocalizedMessage() of Throwable class  RSS feed

 
Puspender Tanwar
Ranch Hand
Posts: 490
2
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what and how to write in getLocalizedMessage(), as normally if we don't override this method, it exactly print the information provided by the getMessage().
I have also read the Locale class, but not found any hint
can someone please explain it with code ?
thank you
 
Campbell Ritchie
Marshal
Posts: 56209
171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds as though you are supposed to create some sort of translation of the ordinary message to a different language.
 
Winston Gutkowski
Bartender
Posts: 10573
65
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Puspender Tanwar wrote:what and how to write in getLocalizedMessage(), as normally if we don't override this method, it exactly print the information provided by the getMessage().

As it says in the docs. It only applies to a subclass that specifically overrides it.

can someone please explain it with code ?

Very simplistically:although how useful it is I don't know.

Winston
 
Rob Spoor
Sheriff
Posts: 21117
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More like the following:
Depending on the locale and the available translation files ("my/pkg/myexception_en_US.properties" etc), this returns a message in English, French, or whatever is available.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!