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

 
 

You are not allowed to post comments on this tracker with your current authentication level.

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:  Python Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  Daiki Ueno <ueno>
Open/Closed:  Closed

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

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only logged-in users can vote.

     

     

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-11-27 haible CategoryNone => Python
    2013-04-23 ueno Open/ClosedOpen => Closed
    2013-04-16 ueno Assigned toNone => ueno
    2013-03-01 m1gu3l Assigned tom1gu3l => None
    2013-03-01 m1gu3l StatusNone => Fixed
        Assigned toNone => m1gu3l

    Back to the top


    Powered by Savane 3.3