Opened 18 years ago
Closed 18 years ago
#3410 closed (fixed)
make-messages has warnings while running xgettext on validators.py, /contrib/admin/views/doc.py, and /utils/html.py
Reported by: | Owned by: | hugo | |
---|---|---|---|
Component: | Internationalization | Version: | dev |
Severity: | Keywords: | gettext | |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I'm getting these errors when I run
./bin/make-messages.py -l pt_BR
from the root django directory:
errors happened while running xgettext on validators.py ./core/validators.py:364: 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.
Attachments (3)
Change History (16)
comment:1 by , 18 years ago
Summary: | errors while running xgettext on validators.py → make-messages cannot deal with non-ASCII message ids |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
comment:3 by , 18 years ago
The offending string appears to be "This value must be between %s and %s." and it doesn't contain any non-ASCII characters.
comment:4 by , 18 years ago
Now I'm getting a different error:
./core/validators.py:364: 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.
comment:5 by , 18 years ago
Has patch: | set |
---|---|
Summary: | make-messages cannot deal with non-ASCII message ids → make-messages has warnings while running xgettext on validators.py |
Sorry, I was reading too quickly. This really has got nothing to do with non-ASCII. It's just a (good) recommendation to use %(name)s
formats instead of %s
, but it's not a bug.
I've attached a patch to fix it, but I don't know if it's worth and what the general policy regarding formats in message id is, so I pass it on as "decision needed".
comment:7 by , 18 years ago
Summary: | make-messages has warnings while running xgettext on validators.py → make-messages has warnings while running xgettext on validators.py and /contrib/admin/views/doc.py |
---|
Thanks for the patch, it worked. But...
errors happened while running xgettext on doc.py ./contrib/admin/views/doc.py:171: 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. ./contrib/admin/views/doc.py:183: 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. ./contrib/admin/views/doc.py:214: 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.
comment:8 by , 18 years ago
Summary: | make-messages has warnings while running xgettext on validators.py and /contrib/admin/views/doc.py → make-messages has warnings while running xgettext on validators.py, /contrib/admin/views/doc.py, and /utils/html.py |
---|
Now one last error:
errors happened while running xgettext on html.py xgettext: Non-ASCII string at ./utils/html.py:10. Please specify the source encoding through --from-code.
comment:9 by , 18 years ago
@mirrorballu2,
What version of xgettext are you using?. Mine is
xgettext (GNU gettext-tools) 0.14.4 Copyright (C) 1995-1998, 2000-2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Written by Ulrich Drepper.
and I don't get any warnings in Django SVN trunk as today.
Just curious about if it is an older or a newer version of xgettext the one generating these (good) warnings.
comment:10 by , 18 years ago
It's a newer version.
xgettext (GNU gettext-tools) 0.15 Copyright (C) 1995-1998, 2000-2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Written by Ulrich Drepper.
comment:11 by , 18 years ago
Triage Stage: | Design decision needed → Ready for checkin |
---|
Why is this in "design decision needed"? Looks like an oversight, because the patch looks perfect (you cannot use positional args in translated strings, so they should be fixed). I'm going to break with protocol slightly and move this ahead a couple of steps in the production line.
The problem with working with multiple versions of xgettext is a separate issue and is a source of never-ending teeth grinding for people working with the gettext tools across different versions. That should be a separate ticket if it really is a problem.
comment:12 by , 18 years ago
Triage Stage: | Ready for checkin → Design decision needed |
---|
Looking over this with my brain turned on, I now see why Michael wanted a call made on this one. It's only generating a warning, not an error. I suspect it's still the right thing to do, to make this change, but I'm going to hold off for a little while until I look at whether we are being consistent throughout Django (I suspect we are because otherwise there would be more warnings). Then I'll update i18n.txt as well.
comment:13 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Yeah, make-messages is unable to deal with message-ids that contain non-ASCII characters. It's because the way make-messages assembles the translation files doesn't allow to specify an encoding, and it's not easily fixed. I'd personally be very thankful for a patch, as I tried and was unable to fix it.
I'm dealing with this by myself with a German-German translation, i.e. in the code I use
and then I have a translation entry that translates "Mueller" to "Müller".
This is *really* nasty. I leave it to the core to decide whether this is a bug. Please take my word, this is not just a minor inconvenience.