bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PO format and libgettextpo: comment leading spaces


From: Bruno Haible
Subject: Re: PO format and libgettextpo: comment leading spaces
Date: Mon, 22 Oct 2007 03:48:35 +0200
User-agent: KMail/1.5.4

Hi,

Dwayne Bailey wrote:
> The PO spec is not clear on leading space in comments.  In libgettextpo
> the following translator comment:
> 
> # Comment1
> # Comment2
> 
> Is returned as the following string when you ask for the translator
> comment:
> 
> " Comment1\n Comment2"
> 
> I think the same happens for extracted comments "#."
> 
> Yet if a send msgcat this file:
> 
> #Comment1
> # Comment2
> 
> It will change it to the first example by adding a space before
> "Comment1"
> 
> This seems to indicate that this is the spec:
> 
> #[space]COMMENT
> #.[SPACE]COMMENT
> 
> That space is part of the marker and shouldn't be returned when querying
> the comment.  I should in fact get back:
> 
> "Comment1\nComment2"  i.e with no leading whitespace on any line.

It's convincing.

Indeed, I would myself have not guessed that when searching for Comment2
using msggrep I had to use
  msggrep -C -E -e '^ Comment2'
Everyone will have thought
  msggrep -C -E -e '^Comment2'
should work. Your proposal thus also fixes msggrep.

Implemented. The NEWS entry reads like this:
* libgettextpo library:
  - The functions po_message_comments and po_message_extracted_comments
    return a multiline string where each line no longer starts with a redundant
    space. The leading space in every comment line is now stripped while
    reading the PO file.
  - Conversely, when you pass a multiline string to the function
    po_message_set_comments or po_message_set_extracted_comments, you normally
    don't pass a space at the beginning of each line, because such spaces are
    no longer trimmed during output.

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]