Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

I18N & Scalability  RSS feed

Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've read tutorials on I18N and have begun implementing it in an application I'm writing.

I've got the basics working, the user selects from a JComboBox, then using the Observer pattern I loop through a list and let them know the language has changed.

I'm using MVC, am I right in thinking that the translation code would be best placed into the Controller level (of which there will be many). So instead of hard-coding the text to appear on labels it would be replaced by several methods called from the controller to set this text based on a ResourceBundle

I might be wrong but I think that with the size of the application (it's a sports management simulation game) that it will be better to only make I18N changes take effect as and when a panel is next shown - the main reason for this the game will have a sort if 'inbox' of messages - translating possibly hundreds of such messages could take a while?

Can anyone comment on whether I'm on the right lines?

If anyone has got tips or recommendations for books / articles to read that cover such things then I would be grateful.

One idea I've had, not sure it's a good one, is to create a wrapper class around a ResourceBundle to hide the re-reading of properties files. Instances of then this class could be passed into the controller who could read as and when instructed to do so - it would not need to keep a track of the locale, bundle name, class loader etc. it would just need to access the class again when informed to do so.

Any thoughts / comments appreciated.


  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!