#14174: Support for string interpolation in lazy translation
-----------------------------------+----------------------------------------
Reporter: zimnyx | Owner: nobody
Status: new | Milestone:
Component: Translations | Version: 1.2
Resolution: | Keywords:
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-----------------------------------+----------------------------------------
Comment (by zimnyx):
Hi!
Let users decide.
If they want to pass mutable which can later change, and they want
translation to be always up-to-date with this value, they just pass
mutable param:
{{{
>>> lst = [1,2,3]
>>> s = ugettext_lazy('Hello %s') % (lst,)
>>> unicode(s)
'Hello [1,2,3]'
>>> lst.append(4)
>>> unicode(s)
'Hello [1,2,3,4]'
}}}
... or if they want to see value with its state during creation of lazy:
{{{
>>> lst = [1,2,3]
>>> s = ugettext_lazy('Hello %s') % (lst[:],)
>>> unicode(s)
'Hello [1,2,3]'
>>> lst.append(4)
>>> unicode(s)
'Hello [1,2,3]'
}}}
I'm not sure about backwards compatibility though... please decide.
--
Ticket URL: <http://code.djangoproject.com/ticket/14174#comment:2>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.