Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

resources.properties

 
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic