Opened 6 years ago

Closed 6 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: UI/UX:

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 Changed 6 years ago by dc

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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