Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on Aug 15, 2014
@niwinz niwinz Make var parsing on i18n temalatize function more permisive.
With this, inner calls to _() function are now not ignored.
Inner calls to _ function are very common on jinja2 templates.

This is a simple example that is ignored with current
django implementation, and now handled correctly with this
patch:

  {{ somefunc("somename", _("translatable string")) }}
72f91be
Showing with 2 additions and 3 deletions.
  1. +2 −3 django/utils/translation/trans_real.py
View
5 django/utils/translation/trans_real.py
@@ -699,9 +699,8 @@ def join_tokens(tokens, trim=False):
out.write(blankout(t.contents, 'B'))
elif t.token_type == TOKEN_VAR:
parts = t.contents.split('|')
- cmatch = constant_re.match(parts[0])
- if cmatch:
- out.write(' _(%s) ' % cmatch.group(1))
+ for m in constant_re.findall(parts[0]):
+ out.write(' _(%s) ' % m)
for p in parts[1:]:
if p.find(':_(') >= 0:
out.write(' %s ' % p.split(':', 1)[1])

No commit comments for this range

Something went wrong with that request. Please try again.