[Django] #29362: makemessages ignores implicitly concatenated string literals

4 views
Skip to first unread message

Django

unread,
Apr 25, 2018, 12:16:10 PM4/25/18
to django-...@googlegroups.com
#29362: makemessages ignores implicitly concatenated string literals
-----------------------------------------+------------------------
Reporter: Chris Bailey | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 2.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
In our company we use python's implicit joining of string literals to
break long lines in our codebase.
We just realised these are being ignored by makemessages.
Don't think this is a bug so much as a comment worth mentioning - maybe
the docs could be updated?

So for example, on an initial site with the following in
`mysite/mysite/__init__.py`:
{{{
from django.utils.translation import pgettext

var_1 = pgettext(
'context1',
'a singleline string',
)

var_2 = pgettext(
'context2',
(
'A '
'multiline '
'string'
)
)
}}}

`django-admin makemessages -l es_ES` produces:
{{{
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-04-25 17:05+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <L...@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: mysite/mysite/__init__.py:5
msgctxt "context1"
msgid "a singleline string"
msgstr ""
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/29362>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 25, 2018, 3:04:16 PM4/25/18
to django-...@googlegroups.com
#29362: makemessages ignores implicitly concatenated string literals
-------------------------------+--------------------------------------

Reporter: Chris Bailey | Owner: nobody
Type: Uncategorized | Status: closed
Component: Uncategorized | Version: 2.0
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Claude Paroz):

* status: new => closed
* resolution: => invalid


Comment:

It will work if you simply remove the parentheses around the second
parameter. Anyway, this is gettext behavior, Django cannot do anything
about it.

--
Ticket URL: <https://code.djangoproject.com/ticket/29362#comment:1>

Reply all
Reply to author
Forward
0 new messages