Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Disaplying error messages in the different languages.

 
Milind V. Kulkarni
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Our application requirement is that we have to display the error messages either in English or in German language depending upon the language selected by the user. In our application error is displayed using an Alert mechanism. We are performing some basic validations at the front end and rest of the validations are performed in the middle layer. All the errors that are trapped in the middle layer are propogated back to the Servlet and finally to JSP so that error can be displayed to the user. To handle various attributes of an error we have defined an error object.
To avoid duplicate error messages we are using error codes to display the error messages. Our strategy to display error messages in English or German language is as follows:
1. We have defined the error codes are java script variables in two java script files Error_en_us.js and Error_de_ch.js.
2. Based on the language selection we are loading one of this file for a given session.
3. Depending upon the error code we are retrieving the error message from one of these files.

I am not very sure whether this is the best strategy to handle multi lingual error messages. Any comments on my strategy would be highly appreciated.

Regards,
Milind
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might be able to check out Java Internationalization by O'Reilly.
They have a Chapter on Internationalized Web Application -- it might be able to give you some good pointers.
Why are you going to use JavaScript? Why not just use pure Java? What if they have JavaScript disabled in their browser? -- Once you find out what Locale the user wants -- you can store the information in Session and access it that way.
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alternatively, check out the JSP Standard Tag Library that contains some i18n tags.
Simon
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic