Opened 11 years ago
Closed 11 years ago
#24091 closed Bug (wontfix)
compilemessages does not detect missing variables in djangojs.po files
| Reported by: | Philipp Metzler | Owned by: | nobody |
|---|---|---|---|
| Component: | Internationalization | Version: | 1.7 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
If django.po contains these lines:
msgid "This is a string with a %(variable)d." msgstr "Das ist eine Zeichenkette ohne Variable."
This error will occur when compiling with
django-admin.py compilemessages
a format specification for argument »variable« doesn't exist in »msgstr«
BUT if a translation file for JavaScript djangojs.po contains the same lines no error will occur and this mistake will not be discovered until you stumble upon it by chance.
Change History (5)
comment:1 by , 11 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 11 years ago
| Description: | modified (diff) |
|---|
comment:3 by , 11 years ago
comment:4 by , 11 years ago
That's correct. How can I configure Django to include #, python-format also in djangojs.po files?
comment:5 by , 11 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
Unfortunately, I'm afraid this is not in Django's hands, as we delegate string extraction to xgettext. And with gettext version >= 0.18.3 we'll use the gettext JavaScript parser on which we have still less control. So I don't see any possible resolution to this. And really, you should not use the %(...)s format when you only have one placeholder in a string, that should minimize the impact of possible mistranslations.
I guess that the msgid line is preceded by
#, python-formatindjango.poand not in thedjangojs.po, right?