[Django] #24091: compilemessages does not detect missing variables in djangojs.po files

30 views
Skip to first unread message

Django

unread,
Jan 7, 2015, 9:41:52 AM1/7/15
to django-...@googlegroups.com
#24091: compilemessages does not detect missing variables in djangojs.po files
--------------------------------------+--------------------
Reporter: googol7 | Owner: nobody
Type: Bug | Status: new
Component: Internationalization | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
If django.po contains these lines:

{{{
msgid "This is a string with a %(variabel)d."
msgstr "Das ist eine Zeichenkette ohne Variable."
}}}

This error will occur when compiling with
{{{
django-admin.py compilemessages
}}}

''a format specification for argument »items« 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.

https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#creating-
message-files-from-javascript-source-code

--
Ticket URL: <https://code.djangoproject.com/ticket/24091>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 7, 2015, 9:43:27 AM1/7/15
to django-...@googlegroups.com
#24091: compilemessages does not detect missing variables in djangojs.po files
-------------------------------------+-------------------------------------

Reporter: googol7 | Owner: nobody
Type: Bug | Status: new
Component: | Version: 1.7
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by googol7):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Old description:

> If django.po contains these lines:
>
> {{{
> msgid "This is a string with a %(variabel)d."
> msgstr "Das ist eine Zeichenkette ohne Variable."
> }}}
>
> This error will occur when compiling with
> {{{
> django-admin.py compilemessages
> }}}
>
> ''a format specification for argument »items« 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.
>
> https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#creating-
> message-files-from-javascript-source-code

New description:

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 »items« 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.

https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#creating-
message-files-from-javascript-source-code

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24091#comment:1>

Django

unread,
Jan 7, 2015, 9:43:50 AM1/7/15
to django-...@googlegroups.com
#24091: compilemessages does not detect missing variables in djangojs.po files
-------------------------------------+-------------------------------------

Reporter: googol7 | Owner: nobody
Type: Bug | Status: new
Component: | Version: 1.7
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by googol7:

Old description:

> 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 »items« 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.
>
> https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#creating-
> message-files-from-javascript-source-code

New description:

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.

https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#creating-
message-files-from-javascript-source-code

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24091#comment:2>

Django

unread,
Jan 7, 2015, 11:30:18 AM1/7/15
to django-...@googlegroups.com
#24091: compilemessages does not detect missing variables in djangojs.po files
-------------------------------------+-------------------------------------

Reporter: googol7 | Owner: nobody
Type: Bug | Status: new
Component: | Version: 1.7
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by claudep):

I guess that the msgid line is preceded by `#, python-format` in
`django.po` and not in the `djangojs.po`, right?

--
Ticket URL: <https://code.djangoproject.com/ticket/24091#comment:3>

Django

unread,
Jan 7, 2015, 12:09:34 PM1/7/15
to django-...@googlegroups.com
#24091: compilemessages does not detect missing variables in djangojs.po files
-------------------------------------+-------------------------------------

Reporter: googol7 | Owner: nobody
Type: Bug | Status: new
Component: | Version: 1.7
Internationalization |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by googol7):

That's correct. How can I configure Django to include {{{#, python-
format}}} also in djangojs.po files?

--
Ticket URL: <https://code.djangoproject.com/ticket/24091#comment:4>

Django

unread,
Jan 7, 2015, 1:51:12 PM1/7/15
to django-...@googlegroups.com
#24091: compilemessages does not detect missing variables in djangojs.po files
-------------------------------------+-------------------------------------
Reporter: googol7 | Owner: nobody
Type: Bug | Status: closed
Component: | Version: 1.7
Internationalization |
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* status: new => closed
* resolution: => wontfix


Comment:

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/24091#comment:5>

Reply all
Reply to author
Forward
0 new messages