#29074: django-admin makemessages messes up .po file when fed with empty strings
-+-
Reporter: | Owner: nobody
instantname|
Type: Bug| Status: new
Component: Core |Version: 1.11
(Management commands) |
Severity: Normal | Keywords: i18n
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 |Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-+-
Django 1.11.9
== Steps to reproduce
{{{
django-admin startproject mysite
cd mysite/mysite
mkdir locale
}}}
Edit urls.py to add this line at the end:
{{{
_('hello')
}}}
Create messages:
{{{
django-admin makemessages -l de
}}}
Edit urls.py again to add this line at the end:
{{{
pgettext_lazy('context', '')
}}}
Update messages:
{{{
django-admin makemessages
}}}
== Result
The locale/de/django.po file obtained is the following:
{{{
# 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-01-27 03:50+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"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: urls.py:23
msgid "hello"
msgstr ""
# 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.
#
#: urls.py:24
#, fuzzy
msgctxt "context"
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-01-27 03:49+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"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
}}}
The unexpected behavior is the repetition of some header lines. This seems
to only happen with empty strings in the Python code. While a bit odd, I
think empty strings are valid strings (at least with a context) that may
sometimes need translation.
--
Ticket URL: <https://code.djangoproject.com/ticket/29074>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/054.047498bb4cb6add70b097da7bf87890d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.