{{{
gettext('Hello, %(addressee)s!') % {'addressee': 'World'}
gettext('Hello, {addressee}!').format(addressee='World')
}}}
Unfortunately, `{% blocktrans %}` always produces the old-style format
with the `%` sign.
I think, it would make sense to add a parameter to the `{% blocktrans %}`
tag by which you could define the python string format you want to
produce.
According to my experience with not-so-technical translators,
`%(variable)s` format in the `django.po` files is more confusing than
`{variable}`.
--
Ticket URL: <https://code.djangoproject.com/ticket/28647>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: Claude Paroz (added)
Comment:
What do you think, Claude?
--
Ticket URL: <https://code.djangoproject.com/ticket/28647#comment:1>
Comment (by Claude Paroz):
I'm not a fan for adding yet another parameter for that.
We could switch to the new `format` syntax, but that would be backwards-
incompatible because po files would change. That could be doable through a
`from future load blocktrans` transition.
Is it worth it? Should we ask on the django-developers ML?
--
Ticket URL: <https://code.djangoproject.com/ticket/28647#comment:2>
* stage: Unreviewed => Someday/Maybe
--
Ticket URL: <https://code.djangoproject.com/ticket/28647#comment:3>
Comment (by Ole Laursen):
Exactly how, I'm not sure, but this would definitely be worthwhile IMHO (I
have a bunch of i18n projects, and yes, transition would be annoying, but
something that could be fixed with a script). I'm sort of living with
this, but today I hit a string that I have defined both in Python and in a
template, and end up with two strings in the .po file:
"Some thing %(foo)s"
"Some thing {foo}"
Grrrr.
--
Ticket URL: <https://code.djangoproject.com/ticket/28647#comment:4>
* cc: Maciej Olko (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/28647#comment:5>