Multilines in language properties

Discussion in 'Java' started by Samuel Murray, Feb 29, 2008.

  1. 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)
    Samuel Murray, Feb 29, 2008
    #1
    1. Advertising

  2. Samuel  Murray

    Jeff Higgins Guest

    Samuel Murray wrote:
    > 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?


    <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:
    >
    > 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, Mar 1, 2008
    #2
    1. Advertising

  3. Samuel  Murray

    Mark Space Guest

    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.
    Mark Space, Mar 1, 2008
    #3
  4. Samuel  Murray

    Roedy Green Guest

    On Fri, 29 Feb 2008 06:05:35 -0800 (PST), Samuel Murray
    <> 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
    Roedy Green, Mar 2, 2008
    #4
  5. G'day Mark

    On Mar 1, 9:14 pm, Mark Space <> wrote:

    > 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)
    Samuel Murray, Mar 2, 2008
    #5
  6. Samuel  Murray

    Jeff Higgins Guest

    Samuel Murray wrote:
    >
    > G'day Mark
    >
    > On Mar 1, 9:14 pm, Mark Space <> wrote:
    >
    >> 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.
    >


    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
    Jeff Higgins, Mar 2, 2008
    #6
  7. Samuel  Murray

    Jeff Higgins Guest

    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.
    Jeff Higgins, Mar 2, 2008
    #7
  8. On Mar 2, 10:15 pm, "Jeff Higgins" <> wrote:

    > 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)
    Samuel Murray, Mar 3, 2008
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nathan Sokalski
    Replies:
    0
    Views:
    888
    Nathan Sokalski
    Oct 17, 2005
  2. =?Utf-8?B?Q2hyaXN0b3BoZSBQZWlsbGV0?=

    CompositeControls: ViewState properties w/ Mapped properties probl

    =?Utf-8?B?Q2hyaXN0b3BoZSBQZWlsbGV0?=, Jan 19, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    1,123
    Steven Cheng[MSFT]
    Jan 19, 2006
  3. lallous

    file w/ multilines?

    lallous, Jan 26, 2004, in forum: Java
    Replies:
    6
    Views:
    332
    Chris Smith
    Jan 27, 2004
  4. Kent Lichty
    Replies:
    0
    Views:
    820
    Kent Lichty
    Apr 16, 2004
  5. Victor Porton
    Replies:
    1
    Views:
    685
    Steven T. Hatton
    Aug 29, 2004
Loading...

Share This Page