This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

resources.properties

 
Velika Srbija
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you any good suggestion on how to include whole paragraphs into resources.properties files; or, is there any workaround?
 
sanjana narayanan
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Velika,

You can just open the properties file in the IDE you are using. The contents of the properties looks like this..

You can write them or copy/paste from a different file.

userRegistration.firstName=First Name
userRegistration.lastName=Last Name
userRegistration.userName=User Name
userRegistration.password=Password
userRegistration.email=Email
userRegistration.phone=Phone
userRegistration.fax=Fax
button.submit=submit
button.cancel=cancel
userRegistration.firstName.problem=firstName cannot be empty
errors.required={0} is required.<br>
errors.minlength={0} cannot be less than {1} characters.<br>


Let me know if you have any questions on this.

Sanjana
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Velika Srbija:
Have you any good suggestion on how to include whole paragraphs into resources.properties files; or, is there any workaround?


You can use whole paragraphs, just keep the paragraph on a single line of the properties file.
 
Velika Srbija
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sanjana,
I knew that already.

Marc Peabody,
you got the point.

But I was already aware of possibility to keep paragraph on a single line. Simply, I don't like it. I believe that there is a restriction on how long a single line can be.? It depends on the OS.?

Is there something better, or the only way is to duplicate my JSP pages, i.e. to provide duplicate pages for each language I intend to support?

Note: I will not use long paragraphs.
 
alan do
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can create multiple text files (place in your web path, eg. mycompany.com/content/) and use <c:import>. each file would differ by the locale (content_en.txt, content_es.txt, etc.). the import url string will is the concatenation between the file name and the locale. obviously, this is like jsp:include. the advantage here is that you don't have jsp's, but text (properties) file instead.

also, if the content for each language is placed on a different server (even in another country), it can be grabbed w/out having redeploy the app if you use jsp:include. obviously, the import url then would be url+fileName (+optionalLocale).
 
Velika Srbija
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds interesting.

But how can I use Struts handling of locale specific resources_??.properties files in order to grab my locale specific content_??.txt files?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic