Opened 3 years ago

Closed 3 years ago

#18479 closed Cleanup/optimization (fixed)

xgettext warnings cause the makemessages command to raise an exception

Reported by: anonymous Owned by: claudep
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 3 years ago by baokham.chau@…

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from baokham.chau@… to anonymous
  • Patch needs improvement unset

comment:2 Changed 3 years ago by claudep

  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to Cleanup/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 3 years ago by niels

  • Cc niels.busch@… added

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

comment:4 Changed 3 years ago by claudep

  • Owner changed from anonymous to claudep
  • Status changed from new to assigned

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

  • Resolution set to fixed
  • Status changed from assigned to closed

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