Opened 4 years ago

Closed 4 years ago

#18479 closed Cleanup/optimization (fixed)

xgettext warnings cause the makemessages command to raise an exception

Reported by: anonymous Owned by: Claude Paroz
Component: Internationalization Version: 1.4
Severity: Normal Keywords:
Cc: niels.busch@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Related to ticket #7564, in that the messages thrown are the same.

System: Macbook Pro, Lion OS, Django 1.4, Python 2.7.3, xgettext 0.18.1

Still seeing the error:

Error: errors happened while running xgettext on models.py ./myproject/models.py:177: warning: 'msgid' format string with unnamed arguments cannot be properly localized:

The translator cannot reorder the arguments. Please consider using a format string with named arguments, and a mapping instead of a tuple for the arguments.

This happens because xgettext will still throw a warning, which will be catch by the "if errors:" block in makemessages.py. Inside the block, we will then raise an exception, regardless of whether or not this error is a fatal error or not. Suggest fix to at least look at the error level (info,warning, error, etc.) and only raise an exception if the error is fatal.

Change History (5)

comment:1 Changed 4 years ago by baokham.chau@…

Owner: changed from baokham.chau@… to anonymous

comment:2 Changed 4 years ago by Claude Paroz

Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

Agreed, we should only raise CommandError if the status code of the executed command is != 0. The _popen function should get and return p.returncode.

comment:3 Changed 4 years ago by Niels Sandholt Busch

Cc: niels.busch@… added

I added a pull request for this ticket here: https://github.com/nsb/django/tree/ticket_18479

comment:4 Changed 4 years ago by Claude Paroz

Owner: changed from anonymous to Claude Paroz
Status: newassigned

comment:5 Changed 4 years ago by Claude Paroz <claude@…>

Resolution: fixed
Status: assignedclosed

In [c54905b3597545dbe1a6d8cd0a60186bccf8b3e7]:

Fixed #18479 -- Stopped makemessages raising error on gettext warnings

Thanks Niels Busch for the initial patch.

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