aspose file tools*
The moose likes Struts and the fly likes resources.properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "resources.properties" Watch "resources.properties" New topic
Author

resources.properties

Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
Have you any good suggestion on how to include whole paragraphs into resources.properties files; or, is there any workaround?
sanjana narayanan
Ranch Hand

Joined: Nov 25, 2003
Posts: 142
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

Joined: Feb 05, 2003
Posts: 4727

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.


A good workman is known by his tools.
Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
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

Joined: Apr 14, 2005
Posts: 354
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).


-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
Velika Srbija
Ranch Hand

Joined: Jan 15, 2002
Posts: 172
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?
 
Consider Paul's rocket mass heater.
 
subject: resources.properties