bugGNU gettext - Bugs: bug #35109, xgettext should detect multi-line...

 
 

bug #35109: xgettext should detect multi-line string concatenation in Python

Submitted by:  None
Submitted on:  Sun 18 Dec 2011 09:30:54 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Daiki Ueno <ueno>
Open/Closed: Closed

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 23 Apr 2013 03:37:33 AM UTC, comment #3:

It should be fixed with:
http://git.savannah.gnu.org/cgit/gettext.git/commit/?h=maint&id=ea9a855bf0773f098bc459b34fff9475819c421c

Daiki Ueno <ueno>
Project AdministratorIn charge of this item.
Tue 15 May 2012 06:35:13 PM UTC, comment #2:

Check the encoding of the source file. I was using DOS encoding and xgettext couldn't detect multiple lines strings.

I changed the encoding to UTF8 and it worked properly.

Hope it helps,

Manuel Kaufmann <humitos>
Mon 09 Apr 2012 06:49:30 PM UTC, comment #1:

It works fine here, using 0.18.1.1-1ubuntu2 (but this does not seem to be a downstream patch). Maybe you need to explicitly use xgettext --language=Python ?

Also, you don't need \ for string multiline concatenation. It is implicit in Python:

CODE:
print _("this works fine" \
" but it is ugly")
print _("this works"
" just as fine")

OUTPUT:
this works fine but it is ugly
this works just as fine

xgettext POT result:
#: g.py:1242
msgid "this works fine but it is ugly"
msgstr ""

#: g.py:1244
msgid "this works just as fine"
msgstr ""

Rodrigo Silva <mestrelion>
Sun 18 Dec 2011 09:30:54 PM UTC, original submission:

In python if I split a message to multiple lines like this:
s = _("How are " \
"you?")

xgettext will detect only the first part of the string:
msgid "How are "
instead of:
msgid "How are you?"

This is necessary to respect the coding style described in PEP 8 to split strings longer than 79 characters.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by ueno (Updated the item)
  • -unavailable- added by m1gu3l (Updated the item)
  • -unavailable- added by humitos (Posted a comment)
  • -unavailable- added by mestrelion (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 23 Apr 2013 03:37:33 AM UTCuenoOpen/ClosedOpen=>Closed
    Tue 16 Apr 2013 06:28:21 AM UTCuenoAssigned toNone=>ueno
    Fri 01 Mar 2013 09:44:38 PM UTCm1gu3lAssigned tom1gu3l=>None
    Fri 01 Mar 2013 09:44:23 PM UTCm1gu3lStatusNone=>Fixed
      Assigned toNone=>m1gu3l

    Back to the top


    Powered by Savane 3.1-cleanup