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: PythonSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Daiki Ueno <ueno>
Open/Closed: Closed

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

It should be fixed with:

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 (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.



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 haible (Updated the item)
  • -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 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 27 Nov 2016 01:16:57 AM UTChaibleCategoryNone=>Python
    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-cleanup1