Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2008

Tip: Looking for answers? Try searching our database.

Multilines in language properties

Thread view: 
Samuel  Murray - 29 Feb 2008 14:05 GMT
G'day everyone

I'm not a Java programmer -- I'm a translator translating Java
properties files.  I lead a project to help volunteer translators
translate opensource programs into their languages, and we'd like to
translate a program that uses non-standard multilines in properties
files.

I was hoping one of you could either tell me the answer or point me to
a URL with the answer to this question:  what is the correct format
for multiple lines, and for multiple lines with line breaks, in a
properties file?

The non-standard properties file I have looks like this:

one = two three
+ four five
+ six seven

and I suspect that a standard properties file will look something like
this:

one = two three\
four five\
six seven

but I'm not 100% sure.  And what if those line breaks should be real
breaks (hard returns, CRLFs, etc)?  Do Java properties files use \n or
something similar?

Thanks in advance
Samuel Murray (leuce)
Jeff Higgins - 01 Mar 2008 17:02 GMT
Samuel Murray wrote:
> G'day everyone
>
[quoted text clipped - 8 lines]
> for multiple lines, and for multiple lines with line breaks, in a
> properties file?

<http://java.sun.com/javase/6/docs/api/java/util/Properties.html#load(java.io.Reader)>

> The non-standard properties file I have looks like this:
>
[quoted text clipped - 15 lines]
> Thanks in advance
> Samuel Murray (leuce)
Mark Space - 01 Mar 2008 19:14 GMT
Samuel Murray wrote:

> one = two three
>  + four five
>  + six seven

Be careful here that the program doesn't expect to see the property
"one" associated with the string "two three + four five + six seven".

Otherwise, something like:

one = two three \
four five \
six seven

is probably what you want.  Note the space before the \ to get spaces
between words.  End of line can be either \n or \r\n.
Samuel  Murray - 02 Mar 2008 19:01 GMT
G'day Mark

> Be careful here that the program doesn't expect to
> see the property "one" associated with the string
> "two three + four five + six seven".

Thanks for pointing that out.  No, I checked the GUI and the plusses
should not be there.

> Note the space before the \ to get spaces between
> words.  End of line can be either \n or \r\n.

Yes, the link Jeff gave also made me realise that leading spaces are
ignored.  Therefore, to have a space between the words on both lines,
the space must precede the slash, and not simply precede the first
word on the next line.  I also see that the space before the slash is
not compulsory -- you only need it of you need to have a space in the
line.

I suspect that for my purposes, \n would be sufficient to indicate
real breaks in the GUI.

Thanks again.
Samuel (leuce)
Jeff Higgins - 02 Mar 2008 20:15 GMT
Samuel Murray wrote:

> G'day Mark
>
[quoted text clipped - 17 lines]
> I suspect that for my purposes, \n would be sufficient to indicate
> real breaks in the GUI.

one = two three\n\ <-- (the properties file processor) only requires this
     three four\n\    (unseen) line terminator == \n, or \r, or \r\n.
     five six\r\  <-- (the GUI) may choke on this \r
     7 8
Samuel  Murray - 03 Mar 2008 08:24 GMT
> Samuel Murray wrote:

> > I suspect that for my purposes, \n would be sufficient to indicate
> > real breaks in the GUI.

> one = two three\n\ <-- (the properties file processor) only requires this
>       three four\n\    (unseen) line terminator == \n, or \r, or \r\n.
>       five six\r\  <-- (the GUI) may choke on this \r

Yes, that's what I meant, thanks.  \n for the break in the GUI and
another slash for the break in the code.

Samuel (leuce)
Jeff Higgins - 02 Mar 2008 20:17 GMT
Samuel Murray wrote:

> I suspect that for my purposes, \n would be sufficient to indicate
> real breaks in the GUI.

one = two three\n\ <-- (the properties file processor) only requires this
     three four\n\    (unseen) line terminator == \n, or \r, or \r\n.
     five six\r\  <-- (the GUI) may choke on this \r
     7 8

If I've understood your comment.
Roedy Green - 02 Mar 2008 00:53 GMT
On Fri, 29 Feb 2008 06:05:35 -0800 (PST), Samuel  Murray
<leuce@absamail.co.za> wrote, quoted or indirectly quoted someone who
said :

>I'm not a Java programmer -- I'm a translator translating Java
>properties files.  I lead a project to help volunteer translators
>translate opensource programs into their languages, and we'd like to
>translate a program that uses non-standard multilines in properties
>files.
These materials may be helpful to you:

http://mindprod.com/jgloss/properties.html
http://mindprod.com/jgloss/localisation.html
http://mindprod.com/project/internationaliser.html

I had composed a detailed plan for a translation tool you may find
interesting.  You also might want to hire me to implement it for you.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.