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

Submitter:  None
Submitted:  Sun 18 Dec 2011 09:30:54 PM UTC
Category:  Python Severity:  3 - Normal
Item Group:  None Status:  Fix Released
Privacy:  Public Assigned to:  ueno
Open/Closed:  Closed

Tue 23 Apr 2013 03:37:33 AM UTC, comment #3: 
Daiki Ueno <ueno>
Group administrator
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 (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:

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

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 " \

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.



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

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)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.


    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-04 haible StatusFixed Fix Released
    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.12.
    Corresponding source code