Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#26670 closed Cleanup/optimization (fixed)

makemessages' plural form handling helper function can insert extra empty line in PO file

Reported by: Ramiro Morales Owned by: Ramiro Morales
Component: Internationalization Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Ramiro Morales)

When it copies the plural form formula header line from Django translations it can insert a line with a triling newline:

https://github.com/django/django/blob/4731e9d82ea72b6d793fb06713d11d228eb89ace/django/core/management/commands/makemessages.py#L624

This is mostly a correctness issue rarely seen in final PO files as makemessages usually runs
the resulting PO file through additional invocations of gettext tools which can correct the issue in case the plural forms formula PO header line is the last one.

Change History (5)

comment:1 Changed 4 years ago by Ramiro Morales

Description: modified (diff)

comment:2 Changed 4 years ago by Ramiro Morales

Owner: changed from nobody to Ramiro Morales
Status: newassigned

comment:3 Changed 4 years ago by Tim Graham

Has patch: set
Triage Stage: UnreviewedReady for checkin

Fixed by PR 6645 according to the commit message there.

comment:4 Changed 4 years ago by Ramiro Morales <cramm0@…>

Resolution: fixed
Status: assignedclosed

In 6ab0d13:

Fixed #26645 -- Fixed potential makemessages failures on Windows.

This was reflected by 27 i18n test errors (not failures) on such
platform caused by corrupt intermediate PO catalog files fed to
msgmerge(1).

Made it handle in-memory PO/POT file contents with normalized line
separators ('\n').

We need to perform manually this after using subprocess.Popen as we
can't pass it universal_newlines=True.

Also fixes #26670 in the process as this commit refactors the same code
section.

comment:5 Changed 4 years ago by Tim Graham <timograham@…>

In fc64407:

[1.10.x] Fixed #26645 -- Fixed potential makemessages failures on Windows.

This was reflected by 27 i18n test errors (not failures) on such
platform caused by corrupt intermediate PO catalog files fed to
msgmerge(1).

Made it handle in-memory PO/POT file contents with normalized line
separators ('\n').

We need to perform manually this after using subprocess.Popen as we
can't pass it universal_newlines=True.

Also fixes #26670 in the process as this commit refactors the same code
section.

Backport of 6ab0d1358fc78077064aab88a4fb0a47ca116391 from master

Note: See TracTickets for help on using tickets.
Back to Top