Opened 15 years ago

Closed 15 years ago

#10662 closed (invalid)

lazy translation cannot be evaluated in string operation

Reported by: liangent Owned by: nobody
Component: Internationalization Version: 1.0
Severity: Keywords: liangent@gmail.com
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

a = ugettext_lazy('sth')
b = 'x%s' % a
c = 'x' + a

both b and c contain something like <django. ... .proxy at ...> in them.

i have to write

a = ugettext_lazy('sth')
b = 'x%s' % unicode(a)
c = 'x' + unicode(a)

to get the expected result

Change History (1)

comment:1 by dc, 15 years ago

Resolution: invalid
Status: newclosed

This is expected behaviour. Read the documentation carefully and use

b = u'x%s' % a

or

b = string_concat('x', a)
Note: See TracTickets for help on using tickets.
Back to Top