Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is resource bundle file used often?

 
Tony Smith
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know resource bundle file is definitely useful for internationalization. But is it a good practice to use it under normal struts application? Seems to me it's easier to just type in the text on the spot instead of having it replaced by resource bundle property file.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most books you read on Struts will recommend as a best practice that you use the Resource Bundle for all literal text. However, you're right: it is a pain in the neck to have to extract every little bit of text you want to use into a properties file. I find myself working on projects where the client has not asked for internationalization, and probably won't any time in the near future. In such a case I normally just put the literal text in the JSP. Should I use the properties file instead? Probably... but then I should floss every day, and I don't do that either.
 
Eugene Abarquez
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree, although it is often recommended in most books that you should externalize all of your strings in the resource bundle, I think it is good that you only do it when it is needed. I have seen some applications before wherein resource bundles have been overused, using them even though internationalization isn't really a requirement. And doesn't using resource bundles increase the overhead, as it stills loads the properties file?
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't floss everyday?!?!

Resource bundles are also handy for keeping the label shown on the screen in sync with the label shown in validation messages. Having all strings in one place can also be handy if you need to change the same word and it appears in several pages (much easier than searching through your JSP files) and to some extent it can help out with spell checking.

- Brent
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic